Fix class name shenanigans for toast notification (#366)

* Fix class name shenanigans for  toast notification

* Corrected number of iterations
This commit is contained in:
Marco Rodolfi
2023-02-07 02:30:44 +01:00
committed by GitHub
parent 0b718daa47
commit 3e120ea312
+6 -3
View File
@@ -40,11 +40,14 @@ class Toaster extends Logger {
let instance: any; let instance: any;
const tree = (document.getElementById('root') as any)._reactRootContainer._internalRoot.current; const tree = (document.getElementById('root') as any)._reactRootContainer._internalRoot.current;
const findToasterRoot = (currentNode: any, iters: number): any => { const findToasterRoot = (currentNode: any, iters: number): any => {
if (iters >= 50) { if (iters >= 65) {
// currently 40 // currently 65
return null; return null;
} }
if (currentNode?.memoizedProps?.className?.startsWith?.('toastmanager_ToastPlaceholder')) { if (
currentNode?.memoizedProps?.className?.startsWith?.('toastmanager_ToastPlaceholder') ||
currentNode?.memoizedProps?.className?.startsWith?.('toastmanager_ToastPopup')
) {
this.log(`Toaster root was found in ${iters} recursion cycles`); this.log(`Toaster root was found in ${iters} recursion cycles`);
return currentNode; return currentNode;
} }