Skip to content

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

web: going back in search after editing a notebook opens notebook edit dialog again (#3979)

Muhammad Alid71e0c109bc6
diff --git a/apps/web/src/navigation/hash-routes.tsx b/apps/web/src/navigation/hash-routes.tsx
index e0dda9071..0ab1988e3 100644
--- a/apps/web/src/navigation/hash-routes.tsx
+++ b/apps/web/src/navigation/hash-routes.tsx
@@ -150,5 +150,6 @@ export default hashroutes;
export type HashRoute = keyof typeof hashroutes;
function afterAction() {
- window.location.hash = "";
+ hashNavigate("/", { replace: true, notify: false });
+ if (!history.state.replace) history.back();
}
diff --git a/apps/web/src/navigation/index.ts b/apps/web/src/navigation/index.ts
index 1d3042657..1471512da 100644
--- a/apps/web/src/navigation/index.ts
+++ b/apps/web/src/navigation/index.ts
@@ -65,8 +65,8 @@ export function hashNavigate<TPath extends HashRoute>(
let url: string = path;
if (addNonce) url += `/${++lastNonce}`;
- if (replace) window.history.replaceState(null, "", `#${url}`);
- else window.history.pushState(null, "", `#${url}`);
+ if (replace) window.history.replaceState({ replace }, "", `#${url}`);
+ else window.history.pushState({ replace }, "", `#${url}`);
const event = new HashChangeEvent("hashchange");
(event as any).notify = notify;