about summary refs log tree commit diff
path: root/src/lib/routes
diff options
context:
space:
mode:
authorAnsh <anshnanda10@gmail.com>2023-05-30 19:16:29 -0700
committerGitHub <noreply@github.com>2023-05-30 21:16:29 -0500
commit3cb8169a4f98cf400b0560001b2d5588bd35b0c0 (patch)
tree3c5180d9faac38fffd8f3890b121263039785cf6 /src/lib/routes
parent421f29ad980e73454f7812e79bff852f362b643e (diff)
downloadvoidsky-3cb8169a4f98cf400b0560001b2d5588bd35b0c0.tar.zst
Fix deeplink when app is suspended (#812)
* Update Navigation.tsx

Missing If statement within the Deep Linking function that broke the ability to change state to hometab

* Updated the function correctly, I missed a bracket

* format

* add pre-existing home state when unspecified path

* Remove unnecessary log

---------

Co-authored-by: Gai <68623807+that-gai-gai@users.noreply.github.com>
Co-authored-by: that-gai-gai <kgai@protonmail.com>
Diffstat (limited to 'src/lib/routes')
-rw-r--r--src/lib/routes/helpers.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/routes/helpers.ts b/src/lib/routes/helpers.ts
index 071e1ae9b..8aef5b83a 100644
--- a/src/lib/routes/helpers.ts
+++ b/src/lib/routes/helpers.ts
@@ -55,10 +55,15 @@ export function getTabState(state: State | undefined, tab: string): TabState {
   return TabState.Outside
 }
 
+type ExistingState = {
+  name: string
+  params?: RouteParams
+}
 export function buildStateObject(
   stack: string,
   route: string,
   params: RouteParams,
+  state: ExistingState[] = [],
 ) {
   if (stack === 'Flat') {
     return {
@@ -70,7 +75,7 @@ export function buildStateObject(
       {
         name: stack,
         state: {
-          routes: [{name: route, params}],
+          routes: [...state, {name: route, params}],
         },
       },
     ],