From 3d5de65077098ff3fb5192cb55fb1534336411f5 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Sun, 13 Jul 2025 02:22:21 -0400 Subject: [PATCH] fix(modals): fix ModalRoot on beta Co-Authored-By: junkrunner --- src/components/Modal.ts | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/components/Modal.ts b/src/components/Modal.ts index 2457960..90f15f4 100755 --- a/src/components/Modal.ts +++ b/src/components/Modal.ts @@ -86,19 +86,23 @@ export const ConfirmModal = findModuleExport( (e: Export) => e?.toString()?.includes('bUpdateDisabled') && e?.toString()?.includes('closeModal') && e?.toString()?.includes('onGamepadCancel'), ) as FC; -export const ModalRoot = Object.values( - findModule((m: any) => { - if (typeof m !== 'object') return false; +export const ModalRoot = + // new + findModuleExport((e: Export) => typeof e === 'function' && e.toString().includes('Either closeModal or onCancel should be passed to GenericDialog. Classes: ')) || + // old + Object.values( + findModule((m: any) => { + if (typeof m !== 'object') return false; - for (let prop in m) { - if (m[prop]?.m_mapModalManager && Object.values(m)?.find((x: any) => x?.type)) { - return true; + for (let prop in m) { + if (m[prop]?.m_mapModalManager && Object.values(m)?.find((x: any) => x?.type)) { + return true; + } } - } - return false; - }) || {}, -)?.find((x: any) => x?.type?.toString?.()?.includes('((function(){')) as FC; + return false; + }) || {}, + )?.find((x: any) => x?.type?.toString?.()?.includes('((function(){')) as FC; interface SimpleModalProps { active?: boolean;