diff --git a/packages/client/src/collection-manager/action-hooks.ts b/packages/client/src/collection-manager/action-hooks.ts index 02a5c9740..a7443cedd 100644 --- a/packages/client/src/collection-manager/action-hooks.ts +++ b/packages/client/src/collection-manager/action-hooks.ts @@ -1,5 +1,6 @@ import { useForm } from '@formily/react'; import { message } from 'antd'; +import { useEffect } from 'react'; import { useCollection, useCollectionManager } from '.'; import { useRequest } from '../api-client'; import { useRecord } from '../record-provider'; @@ -202,10 +203,17 @@ export const useBulkDestroyAction = () => { export const useValuesFromRecord = (options) => { const record = useRecord(); - return useRequest(() => Promise.resolve({ data: record }), { + const result = useRequest(() => Promise.resolve({ data: record }), { ...options, - refreshDeps: [record], + manual: true, }); + const ctx = useActionContext(); + useEffect(() => { + if (ctx.visible) { + result.run(); + } + }, [ctx.visible]); + return result; }; export const useValuesFromRA = (options) => {