mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 03:45:10 +00:00
fix: bug
This commit is contained in:
parent
4132659670
commit
5f37f7a523
@ -305,6 +305,8 @@ export class CollectionManagerV2<Mixins = {}> {
|
||||
private getInheritData() {
|
||||
return {
|
||||
collections: this.collections,
|
||||
collectionFieldGroups: this.collectionFieldGroups,
|
||||
reloadCallbacks: this.reloadCallbacks,
|
||||
collectionTemplateInstances: this.collectionTemplateInstances,
|
||||
fieldInterfaceInstances: this.fieldInterfaceInstances,
|
||||
collectionMixins: this.collectionMixins,
|
||||
|
@ -55,6 +55,7 @@ export class CollectionPlugin extends Plugin {
|
||||
this.addFieldInterfaces();
|
||||
this.addCollectionTemplates();
|
||||
this.addFieldInterfaces();
|
||||
this.addFieldGroups();
|
||||
|
||||
this.collectionManager.setReloadFn(this.reloadCollections.bind(this));
|
||||
}
|
||||
|
@ -12,14 +12,13 @@ export const useCollectionManager = () => {
|
||||
const [random, setRandom] = useState(uid());
|
||||
const interfaces = useMemo(() => cm?.getFieldInterfaces(), [cm, random]);
|
||||
const templates = useMemo(() => cm?.getCollectionTemplates(), [cm, random]);
|
||||
const collections = useMemo(
|
||||
() =>
|
||||
cm
|
||||
?.getCollections()
|
||||
.filter((item) => !item.isLocal)
|
||||
.map((item) => item.getOptions()),
|
||||
[cm, random],
|
||||
);
|
||||
const getCollections = useCallback(() => {
|
||||
return cm
|
||||
?.getCollections()
|
||||
.filter((item) => !item.isLocal)
|
||||
.map((item) => item.getOptions());
|
||||
}, [cm]);
|
||||
const collections = useMemo(() => getCollections(), [cm, random]);
|
||||
const { refresh } = useSchemaComponentContext();
|
||||
const service = useCallback(() => cm?.reload(refresh), [cm]);
|
||||
const updateCollection = cm?.setCollections.bind(cm);
|
||||
@ -236,6 +235,7 @@ export const useCollectionManager = () => {
|
||||
templates,
|
||||
getTemplate,
|
||||
getInterface,
|
||||
getCollections,
|
||||
getParentCollectionFields,
|
||||
getInheritCollections,
|
||||
getChildrenCollections,
|
||||
|
@ -372,7 +372,7 @@ export const GraphDrawPage = React.memo(() => {
|
||||
const [collectionData, setCollectionData] = useState<any>([]);
|
||||
const [collectionList, setCollectionList] = useState<any>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { collections } = useCollectionManager();
|
||||
const { collections, getCollections } = useCollectionManager();
|
||||
const cm = useCollectionManagerV2();
|
||||
const currentAppInfo = useCurrentAppInfo();
|
||||
const app = useApp();
|
||||
@ -412,7 +412,9 @@ export const GraphDrawPage = React.memo(() => {
|
||||
refreshPositions();
|
||||
}
|
||||
};
|
||||
const reloadCallback = async (collections) => {
|
||||
const reloadCallback = async () => {
|
||||
const collections = getCollections();
|
||||
if (!targetGraph) return;
|
||||
targetGraph.collections = collections;
|
||||
targetGraph.updatePositionAction = updatePositionAction;
|
||||
targetGraph.saveGraphPositionAction = saveGraphPositionAction;
|
||||
@ -1072,7 +1074,7 @@ export const GraphDrawPage = React.memo(() => {
|
||||
setLoading(true);
|
||||
refreshPositions()
|
||||
.then(async () => {
|
||||
await reloadCallback(collections);
|
||||
await reloadCallback();
|
||||
setLoading(false);
|
||||
})
|
||||
.catch((err) => {
|
||||
|
Loading…
Reference in New Issue
Block a user