From 88166cdfddecccdb1d983cf06fc7ddcbf1b4823b Mon Sep 17 00:00:00 2001 From: Utku <74243531+utkubakir@users.noreply.github.com> Date: Sat, 17 Jun 2023 03:44:07 +0300 Subject: [PATCH] [MOB-27] - Fix deleting library putting you to onboarding (#951) fix --- apps/mobile/src/App.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/mobile/src/App.tsx b/apps/mobile/src/App.tsx index b0a27fe23..5e3aaab99 100644 --- a/apps/mobile/src/App.tsx +++ b/apps/mobile/src/App.tsx @@ -42,7 +42,7 @@ initPlausible({ platformType: 'mobile' }); changeTwTheme('dark'); function AppNavigation() { - const { library } = useClientContext(); + const { libraries, library } = useClientContext(); // TODO: Make sure library has actually been loaded by this point - precache with useCachedLibraries? // if (library === undefined) throw new Error("Tried to render AppNavigation before libraries fetched!") @@ -54,6 +54,10 @@ function AppNavigation() { usePlausiblePageViewMonitor({ currentPath }); + if (library === null && libraries.data) { + currentLibraryStore.id = libraries.data[0]?.uuid ?? null; + } + return (