fix: restore useValuesFromRecord
This commit is contained in:
parent
dea9655573
commit
6799c9615d
@ -1,13 +1,12 @@
|
||||
import { message } from 'antd';
|
||||
import omit from 'lodash/omit';
|
||||
import { useEffect } from 'react';
|
||||
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';
|
||||
import { useActionContext } from '../schema-component';
|
||||
import { useFilterFieldOptions, useFilterFieldProps } from '../schema-component/antd/filter/useFilterActionProps';
|
||||
import { useResourceActionContext, useResourceContext } from './ResourceActionProvider';
|
||||
import { useFilterFieldProps, useFilterFieldOptions } from '../schema-component/antd/filter/useFilterActionProps';
|
||||
|
||||
export const useCancelAction = () => {
|
||||
const form = useForm();
|
||||
@ -20,6 +19,21 @@ export const useCancelAction = () => {
|
||||
};
|
||||
};
|
||||
|
||||
export const useValuesFromRecord = (options) => {
|
||||
const record = useRecord();
|
||||
const result = useRequest(() => Promise.resolve({ data: record }), {
|
||||
...options,
|
||||
manual: true,
|
||||
});
|
||||
const ctx = useActionContext();
|
||||
useEffect(() => {
|
||||
if (ctx.visible) {
|
||||
result.run();
|
||||
}
|
||||
}, [ctx.visible]);
|
||||
return result;
|
||||
};
|
||||
|
||||
export const useResetFilterAction = () => {
|
||||
const { run } = useResourceActionContext();
|
||||
const form = useForm();
|
||||
@ -259,7 +273,6 @@ export const useBulkDestroyAction = () => {
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
export const useValuesFromRA = (options) => {
|
||||
const ctx = useResourceActionContext();
|
||||
return useRequest(() => Promise.resolve(ctx.data), {
|
||||
|
Loading…
Reference in New Issue
Block a user