Skip to content

Commit

Permalink
primitive handling of the back button.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Sep 6, 2023
1 parent 256a1c3 commit c638d53
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/routes/[...path]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,17 @@
}
tabs.set($tabs);
let prev = $page.params.path.split('/');
return page.subscribe((v) => {
let path = v.params.path.split('/');
if (path.length < prev.length) {
let removed = prev.find((item) => !path.includes(item));
if (removed) {
tabs.set($tabs.filter((tab) => tab.data !== removed));
}
}
prev = path;
});
});
</script>

0 comments on commit c638d53

Please sign in to comment.