From 5fd5b2f08cd39a26eecab8901c1d39020c056ac1 Mon Sep 17 00:00:00 2001
From: AAGaming <aagaming@riseup.net>
Date: Tue, 12 Dec 2023 22:21:25 -0500
Subject: fix: Adjust tabs and toaster hooks to work on react 18, also half-fix
 Valve Internal

---
 frontend/src/toaster.tsx | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

(limited to 'frontend/src/toaster.tsx')

diff --git a/frontend/src/toaster.tsx b/frontend/src/toaster.tsx
index 7ef4a447..0db8889a 100644
--- a/frontend/src/toaster.tsx
+++ b/frontend/src/toaster.tsx
@@ -1,4 +1,13 @@
-import { Module, Patch, ToastData, afterPatch, findInReactTree, findModuleChild, sleep } from 'decky-frontend-lib';
+import {
+  Module,
+  Patch,
+  ToastData,
+  afterPatch,
+  findInReactTree,
+  findModuleChild,
+  getReactRoot,
+  sleep,
+} from 'decky-frontend-lib';
 import { ReactNode } from 'react';
 
 import Toast from './components/Toast';
@@ -38,10 +47,10 @@ class Toaster extends Logger {
     //   </DeckyToasterStateContextProvider>
     // ));
     let instance: any;
-    const tree = (document.getElementById('root') as any)._reactRootContainer._internalRoot.current;
+    const tree = getReactRoot(document.getElementById('root') as any);
     const findToasterRoot = (currentNode: any, iters: number): any => {
-      if (iters >= 65) {
-        // currently 65
+      if (iters >= 80) {
+        // currently 66
         return null;
       }
       if (
-- 
cgit v1.2.3

