Skip to content

Commit

Permalink
add replace to a bunch of redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendonovich committed Dec 7, 2023
1 parent 0c42558 commit 685f743
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion interface/app/$libraryId/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export default (platform: Platform) =>
loader: async () => {
if (!platform.userHomeDir) return null;
const homeDir = await platform.userHomeDir();
return redirect(`ephemeral/0?${new URLSearchParams({ path: homeDir })}`);
return redirect(`ephemeral/0?${new URLSearchParams({ path: homeDir })}`, {
replace: true
});
}
},
topBarRoutes,
Expand Down
10 changes: 6 additions & 4 deletions interface/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ export const createRoutes = (platform: Platform, cache: NormalisedCache) =>

const libraryId = currentLibrary ? currentLibrary.uuid : libraries[0]?.uuid;

if (libraryId === undefined) return redirect('/onboarding');
if (libraryId === undefined)
return redirect('/onboarding', { replace: true });

return redirect(`/${libraryId}`);
return redirect(`/${libraryId}`, { replace: true });
}
},
{
Expand All @@ -86,8 +87,9 @@ export const createRoutes = (platform: Platform, cache: NormalisedCache) =>
if (!library) {
const firstLibrary = libraries[0];

if (firstLibrary) return redirect(`/${firstLibrary.uuid}`);
else return redirect('/onboarding');
if (firstLibrary)
return redirect(`/${firstLibrary.uuid}`, { replace: true });
else return redirect('/onboarding', { replace: true });
}

return null;
Expand Down
6 changes: 4 additions & 2 deletions interface/app/onboarding/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ export default [
index: true,
loader: () => {
if (getOnboardingStore().lastActiveScreen)
return redirect(`/onboarding/${getOnboardingStore().lastActiveScreen}`);
return redirect(`/onboarding/${getOnboardingStore().lastActiveScreen}`, {
replace: true
});

return redirect(`/onboarding/alpha`);
return redirect(`/onboarding/alpha`, { replace: true });
},
element: <Index />
},
Expand Down

0 comments on commit 685f743

Please sign in to comment.