From 81f7aca3afbad188027437e2d1aac1be9ab74531 Mon Sep 17 00:00:00 2001 From: gegenhasi Date: Fri, 17 Nov 2023 16:20:25 +0800 Subject: [PATCH] fix(GISDK): canvas loading when fetching schema --- packages/gi-sdk/src/Initializer.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/gi-sdk/src/Initializer.tsx b/packages/gi-sdk/src/Initializer.tsx index 4fed85873..45fed4790 100644 --- a/packages/gi-sdk/src/Initializer.tsx +++ b/packages/gi-sdk/src/Initializer.tsx @@ -30,6 +30,10 @@ const Initializer: React.FunctionComponent = props => { service: () => Promise.resolve(null), }; + updateContext(draft => { + draft.isLoading = true; + }); + Promise.all([schemaService(), initialService()]).then(([schema, data = { nodes: [], edges: [] }]) => { updateContext(draft => { const { nodes, edges } = data; @@ -39,6 +43,7 @@ const Initializer: React.FunctionComponent = props => { draft.schemaData = schema as any; } + const position = isPosition(nodes); const style = isStyles(nodes); if (position) { @@ -69,6 +74,7 @@ const Initializer: React.FunctionComponent = props => { } draft.initialized = true; draft.layoutCache = false; + draft.isLoading = false; }); }); }, [largeGraphLimit]);