From 44bb023b804b0ab360214360a3947935fb41c86c Mon Sep 17 00:00:00 2001 From: AAGaming Date: Wed, 15 Oct 2025 00:31:12 -0400 Subject: React 19 support (#818) --- frontend/src/index.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'frontend/src/index.ts') diff --git a/frontend/src/index.ts b/frontend/src/index.ts index 2ee018e0..4f4ff4f7 100644 --- a/frontend/src/index.ts +++ b/frontend/src/index.ts @@ -1,8 +1,4 @@ // Sets up DFL, then loads start.ts which starts up the loader -interface Window { - // Shut up TS - SP_REACTDOM: any; -} (async () => { console.debug('[Decky:Boot] Frontend init'); @@ -21,7 +17,19 @@ interface Window { // deliberate partial import const DFLWebpack = await import('@decky/ui/dist/webpack'); window.SP_REACT = DFLWebpack.findModule((m) => m.Component && m.PureComponent && m.useLayoutEffect); - window.SP_REACTDOM = DFLWebpack.findModule((m) => m.createPortal && m.createRoot); + window.SP_REACTDOM = + DFLWebpack.findModule((m) => m.createPortal && m.createRoot) || + DFLWebpack.findModule((m) => m.createPortal && m.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE); + + console.debug('[Decky:Boot] Setting up JSX internals...'); + const jsx = DFLWebpack.findModule((m) => m.jsx && Object.keys(m).length == 1)?.jsx; + if (jsx) { + window.SP_JSX = { + jsx, + jsxs: jsx, + Fragment: window.SP_REACT.Fragment, + }; + } } console.debug('[Decky:Boot] Setting up @decky/ui...'); window.DFL = await import('@decky/ui'); -- cgit v1.2.3