diff --git a/packages/amis/src/renderers/CRUD2.tsx b/packages/amis/src/renderers/CRUD2.tsx index d7744c9bb..b2fac5978 100644 --- a/packages/amis/src/renderers/CRUD2.tsx +++ b/packages/amis/src/renderers/CRUD2.tsx @@ -1056,23 +1056,35 @@ export default class CRUD2 extends React.Component { // @ts-ignore return this[`handle${upperFirst(action.actionType)}`](data); } - // const {onAction, data: ctx} = this.props; - // return this.props.onAction?.( - // undefined, - // action, - // ctx, - // throwErrors, - // undefined - // ); } @autobind handleAction( e: React.UIEvent | undefined, action: ActionObject, - ctx: object + ctx: object, + throwErrors: boolean = false, + delegate?: IScopedContext ) { - return this.doAction(action, ctx); + if ( + [ + 'stopAutoRefresh', + 'reload', + 'search', + 'startAutoRefresh', + 'loadMore' + ].includes(action.actionType as any) + ) { + return this.doAction(action, ctx, throwErrors); + } else { + return this.props.onAction( + e, + action, + ctx, + throwErrors, + delegate || this.context + ); + } } unSelectItem(item: any, index: number) {