From e6b1950bcb7795114be6a2d0c2e85434d883284b Mon Sep 17 00:00:00 2001 From: AAGaming Date: Thu, 13 Jun 2024 15:12:24 -0400 Subject: fix for latest beta (backport) --- frontend/src/index.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'frontend/src') diff --git a/frontend/src/index.ts b/frontend/src/index.ts index a108df66..7bb935c7 100644 --- a/frontend/src/index.ts +++ b/frontend/src/index.ts @@ -1,12 +1,24 @@ // Sets up DFL, then loads start.ts which starts up the loader +interface Window { + // Shut up TS + SP_REACTDOM: any; +} + (async () => { - console.debug('Setting up @decky/ui...'); + if (!window.SP_REACT) { + console.debug('[Decky:Boot] Setting up React globals...'); + // deliberate partial import + const DFLWebpack = await import('decky-frontend-lib/dist/webpack'); + window.SP_REACT = DFLWebpack.findModule((m) => m.Component && m.PureComponent && m.useLayoutEffect); + window.SP_REACTDOM = DFLWebpack.findModule((m) => m.createPortal && m.createRoot); + } + console.debug('[Decky:Boot] Setting up @decky/ui...'); window.DFL = await import('@decky/ui'); - console.debug('Authenticating with Decky backend...'); + console.debug('[Decky:Boot] Authenticating with Decky backend...'); window.deckyAuthToken = await fetch('http://127.0.0.1:1337/auth/token').then((r) => r.text()); - console.debug('Connecting to Decky backend...'); + console.debug('[Decky:Boot] Connecting to Decky backend...'); window.DeckyBackend = new (await import('./wsrouter')).WSRouter(); await DeckyBackend.connect(); - console.debug('Starting Decky!'); + console.debug('[Decky:Boot] Starting Decky!'); await import('./start'); })(); -- cgit v1.2.3