Skip to content

Build your personal knowledge base with Trilium Notes

fix(setup): redirects to /setup on browser

Elian Dorana5da35b7aedf
diff --git a/apps/client/src/setup.tsx b/apps/client/src/setup.tsx
index 7c9dad57ec..ba71d0511f 100644
--- a/apps/client/src/setup.tsx
+++ b/apps/client/src/setup.tsx
@@ -167,7 +167,7 @@ function SyncInProgress({ device }: { device: "server" | "desktop" }) {
useEffect(() => {
if (stats.initialized) {
- location.href = "setup";
+ onSetupFinished();
}
}, [stats.initialized]);
@@ -250,9 +250,7 @@ function CreateNewDocumentOptions({ setState }: { setState: (state: State) => vo
function CreateNewDocumentInProgress({ withDemo = false }: { withDemo?: boolean }) {
useEffect(() => {
- server.post(`setup/new-document${withDemo ? "" : "?skipDemoDb"}`).then(() => {
- location.href = "setup";
- });
+ server.post(`setup/new-document${withDemo ? "" : "?skipDemoDb"}`).then(onSetupFinished);
}, [ withDemo ]);
return (
@@ -502,4 +500,13 @@ function networkScore(addr: string): number {
return 3;
}
+function onSetupFinished() {
+ if (isElectron()) {
+ // On Electron we need to use the setup route because it handles the closing of the setup window and opening the main app window.
+ location.href = "setup";
+ } else {
+ location.reload();
+ }
+}
+
main();