Skip to content

Commit

Permalink
web: going back in search after editing a notebook opens notebook edi…
Browse files Browse the repository at this point in the history
…t dialog again (streetwriters#3979)

* web: changed afterAction()

* web: fix back navigation for dialogs that replace

* web: remove unused import

---------

Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
  • Loading branch information
alihamuh and thecodrr authored Dec 18, 2023
1 parent 7e34530 commit d71e0c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/web/src/navigation/hash-routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
4 changes: 2 additions & 2 deletions apps/web/src/navigation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d71e0c1

Please sign in to comment.