Fix workspace/request creation race

This commit is contained in:
Gregory Schier
2024-10-22 14:27:12 -07:00
parent 94f8949ca2
commit 5de50c70c6
3 changed files with 20 additions and 5 deletions

View File

@@ -18,7 +18,12 @@ export function useCreateWorkspace() {
placeholder: 'My Workspace',
confirmText: 'Create',
});
return invokeCmd('cmd_create_workspace', { name });
const workspace = await invokeCmd<Workspace>('cmd_create_workspace', { name });
// Give some time for the workspace to sync to the local store
await new Promise((resolve) => setTimeout(resolve, 100));
return workspace;
},
onSuccess: async (workspace) => {
routes.navigate('workspace', { workspaceId: workspace.id });