From 832a2031bbac9baeabb7c44c8bc2f297a605467a Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Sat, 9 May 2026 11:04:38 +0700 Subject: [PATCH] fix(app): hoist QueryProvider above PortalProvider so portaled sheets see QueryClient @gorhom/portal renders children at the host's location in the tree, so sheets portaled to the root host lost QueryClient context (crash: "No QueryClient set" when opening provider diagnostic sheet). Reorder RootProviders and document the invariant: PortalProvider stays innermost. --- packages/app/src/app/_layout.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/app/src/app/_layout.tsx b/packages/app/src/app/_layout.tsx index 4d7269e71..1222b707c 100644 --- a/packages/app/src/app/_layout.tsx +++ b/packages/app/src/app/_layout.tsx @@ -889,15 +889,20 @@ function RuntimeProviders({ children }: { children: ReactNode }) { ); } +// PortalProvider must remain the innermost global provider here. +// `@gorhom/portal` renders portaled children at the host's location in the +// tree, so any context a portaled sheet might consume (QueryClient, theme, +// auth, settings, …) must wrap PortalProvider — not be wrapped by it. +// Adding a new global provider? Put it above PortalProvider. function RootProviders({ children }: { children: ReactNode }) { return ( - + - {children} + {children} - + ); }