mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
fix: after success link (#6707)
This commit is contained in:
parent
8e4ccd1916
commit
5931e2914e
@ -12,9 +12,9 @@ import { useCollection_deprecated, useCollectionFilterOptions } from '../../../.
|
|||||||
import { useCollectionRecordData } from '../../../../data-source';
|
import { useCollectionRecordData } from '../../../../data-source';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useCompile } from '../../../';
|
import { useCompile } from '../../../';
|
||||||
import { useBlockContext } from '../../../../block-provider/BlockProvider';
|
|
||||||
import { usePopupVariable } from '../../../../schema-settings/VariableInput/hooks';
|
import { usePopupVariable } from '../../../../schema-settings/VariableInput/hooks';
|
||||||
import { useCurrentRoleVariable } from '../../../../schema-settings/VariableInput/hooks';
|
import { useCurrentRoleVariable } from '../../../../schema-settings/VariableInput/hooks';
|
||||||
|
import { useFormBlockContext } from '../../../../block-provider';
|
||||||
|
|
||||||
export const useAfterSuccessOptions = () => {
|
export const useAfterSuccessOptions = () => {
|
||||||
const collection = useCollection_deprecated();
|
const collection = useCollection_deprecated();
|
||||||
@ -23,7 +23,7 @@ export const useAfterSuccessOptions = () => {
|
|||||||
const userFieldOptions = useCollectionFilterOptions('users', 'main');
|
const userFieldOptions = useCollectionFilterOptions('users', 'main');
|
||||||
const compile = useCompile();
|
const compile = useCompile();
|
||||||
const recordData = useCollectionRecordData();
|
const recordData = useCollectionRecordData();
|
||||||
const { name: blockType } = useBlockContext() || {};
|
const { form } = useFormBlockContext();
|
||||||
const [fields, userFields] = useMemo(() => {
|
const [fields, userFields] = useMemo(() => {
|
||||||
return [compile(fieldsOptions), compile(userFieldOptions)];
|
return [compile(fieldsOptions), compile(userFieldOptions)];
|
||||||
}, [fieldsOptions, userFieldOptions]);
|
}, [fieldsOptions, userFieldOptions]);
|
||||||
@ -32,7 +32,7 @@ export const useAfterSuccessOptions = () => {
|
|||||||
const record = useCollectionRecordData();
|
const record = useCollectionRecordData();
|
||||||
return useMemo(() => {
|
return useMemo(() => {
|
||||||
return [
|
return [
|
||||||
(record || blockType === 'form') && {
|
(record || form) && {
|
||||||
value: '$record',
|
value: '$record',
|
||||||
label: t('Response record', { ns: 'client' }),
|
label: t('Response record', { ns: 'client' }),
|
||||||
children: [...fields],
|
children: [...fields],
|
||||||
@ -62,5 +62,5 @@ export const useAfterSuccessOptions = () => {
|
|||||||
children: null,
|
children: null,
|
||||||
},
|
},
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
}, [recordData, t, fields, blockType, userFields]);
|
}, [recordData, t, fields, form, userFields]);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user