From 2332c5639f8a14621f3bf720e40b5bd2f7996333 Mon Sep 17 00:00:00 2001 From: Sergey Garin Date: Thu, 22 Aug 2024 15:29:54 +0300 Subject: [PATCH] Add artificial delay before showing a project --- app/dashboard/src/layouts/Editor.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/dashboard/src/layouts/Editor.tsx b/app/dashboard/src/layouts/Editor.tsx index ab02f08eee..169d3d9250 100644 --- a/app/dashboard/src/layouts/Editor.tsx +++ b/app/dashboard/src/layouts/Editor.tsx @@ -97,6 +97,19 @@ export default function Editor(props: EditorProps) { networkMode: project.type === backendModule.BackendType.remote ? 'online' : 'always', }) + const artificialDelayQuery = reactQuery.useQuery({ + queryKey: ['artificialDelay'], + queryFn: async () => { + return new Promise((resolve) => { + setTimeout(() => { + resolve('test') + }, 3_000) + }) + }, + gcTime: 0, + enabled: projectQuery.data?.state.type === backendModule.ProjectState.opened, + }) + const isProjectClosed = projectQuery.data?.state.type === backendModule.ProjectState.closed const shouldRefetch = !projectQuery.isError && !projectQuery.isLoading @@ -126,6 +139,7 @@ export default function Editor(props: EditorProps) { ) } else if ( projectQuery.isLoading || + artificialDelayQuery.isLoading || projectQuery.data?.state.type !== backendModule.ProjectState.opened ) { return