Skip to content

Commit

Permalink
Wait for an additional second after Workspace loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-robert committed Dec 2, 2024
1 parent 4af9ec3 commit 1f66aa3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hooks/project-hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ export const ProjectProvider = ({
const startUpTimeout = 90000;
const startUpTimestamp = useRef<number>(Date.now());

const onWorkspaceLoaded = useCallback(() => {
const onWorkspaceLoaded = useCallback(async () => {
// Wait another second because it's not really ready at this point.
await new Promise((res) => setTimeout(res, 1000));
logging.log("[MakeCode] Workspace loaded");

// Get latest start up state and only mark editor ready if editor has not timed out.
getEditorStartUp() !== "timed out" && editorReady();
editorReadyPromiseRef.current.resolve();
Expand Down

0 comments on commit 1f66aa3

Please sign in to comment.