Skip to content

Commit

Permalink
potentially fix startup race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 committed Sep 12, 2024
1 parent 1d7af36 commit ef4ca20
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ interface Window {
console.time('[Decky:Boot] Waiting for React root mount...');
let root;
while (
// Does React root node exist?
!(root = document.getElementById('root')) ||
!(root as any)[Object.keys(root).find((k) => k.startsWith('__reactContainer$')) as string]
// Does it have a child element?
!(root as any)[Object.keys(root).find((k) => k.startsWith('__reactContainer$')) as string].child
) {
await new Promise((r) => setTimeout(r, 10)); // Can't use DFL sleep here.
}
Expand Down

0 comments on commit ef4ca20

Please sign in to comment.