mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 01:57:16 +00:00
fix: e2e bug
This commit is contained in:
parent
cf8c30d435
commit
59abd5b41d
@ -1,7 +1,7 @@
|
||||
import { CascaderProps } from 'antd';
|
||||
import _ from 'lodash';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useCompile } from '../../schema-component';
|
||||
import { useCompile, useSchemaComponentContext } from '../../schema-component';
|
||||
import { CollectionFieldOptions, CollectionOptions } from '../types';
|
||||
import { useCollectionManagerV2 } from '../../application';
|
||||
import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin';
|
||||
@ -13,6 +13,7 @@ export const useCollectionManager = (namespace?: string) => {
|
||||
const blockNamespaceValue = useCollectionNamespace();
|
||||
const namespaceValue = namespace || blockNamespaceValue || undefined;
|
||||
const [random, setRandom] = useState(uid());
|
||||
const { refresh } = useSchemaComponentContext();
|
||||
const interfaces = useMemo(() => cm?.getFieldInterfaces(), [cm, random]);
|
||||
const templates = useMemo(() => cm?.getCollectionTemplates(), [cm, random]);
|
||||
const getCollections = useCallback(() => {
|
||||
@ -22,9 +23,23 @@ export const useCollectionManager = (namespace?: string) => {
|
||||
.map((item) => item.getOptions());
|
||||
}, [cm]);
|
||||
const collections = useMemo(() => getCollections(), [cm, random]);
|
||||
const service = useCallback(() => cm?.reloadMain(() => setRandom(uid())), [cm]);
|
||||
const service = useCallback(
|
||||
() =>
|
||||
cm?.reloadMain(() => {
|
||||
refresh();
|
||||
setRandom(uid());
|
||||
}),
|
||||
[cm],
|
||||
);
|
||||
const updateCollection = cm?.setCollections.bind(cm);
|
||||
const refreshCM = useCallback(() => cm?.reloadMain(() => setRandom(uid())), [cm]);
|
||||
const refreshCM = useCallback(
|
||||
() =>
|
||||
cm?.reloadMain(() => {
|
||||
refresh();
|
||||
setRandom(uid());
|
||||
}),
|
||||
[cm],
|
||||
);
|
||||
|
||||
const compile = useCompile();
|
||||
const getInheritedFields = useCallback(
|
||||
|
Loading…
Reference in New Issue
Block a user