Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: #144

thecodrrf83b2a019f87
diff --git a/apps/web/src/navigation/index.js b/apps/web/src/navigation/index.js
index 1def974dd..9b05d9ad6 100644
--- a/apps/web/src/navigation/index.js
+++ b/apps/web/src/navigation/index.js
@@ -24,6 +24,7 @@ class Navigator {
lastRoute: this.getRoute(this.options.default),
});
this.history = opts.history;
+ this.lastRoute = undefined;
this.navigate(opts.lastRoute.key, opts.lastRoute.params, true);
};
@@ -31,6 +32,14 @@ class Navigator {
return this.routes[key];
}
+ pushToHistory() {
+ const lastItem = this.history[this.history.length - 1];
+ if (this.lastRoute) {
+ if (lastItem && lastItem.key === this.lastRoute.key) return;
+ this.history.push(this.lastRoute);
+ }
+ }
+
setLastRoute(route) {
this.lastRoute = route;
// cache the route in localStorage
@@ -58,10 +67,9 @@ class Navigator {
route.params = { ...route.params, ...params };
- if (this.lastRoute) {
- this.history.push(this.lastRoute);
- }
+ this.pushToHistory();
this.setLastRoute(route);
+
return this.renderRoute(route);
}
@@ -70,6 +78,7 @@ class Navigator {
if (!root) {
return false;
}
+
// exit selection mode on navigate
selectionStore.toggleSelectionMode(false);