potentially fix startup race condition

This commit is contained in:
AAGaming
2024-09-11 20:16:49 -04:00
parent 1d7af36a2b
commit ef4ca204bd
+3 -1
View File
@@ -16,8 +16,10 @@ interface Window {
console.time('[Decky:Boot] Waiting for React root mount...'); console.time('[Decky:Boot] Waiting for React root mount...');
let root; let root;
while ( while (
// Does React root node exist?
!(root = document.getElementById('root')) || !(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. await new Promise((r) => setTimeout(r, 10)); // Can't use DFL sleep here.
} }