mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-09-11 12:25:42 +03:00
store uri in nav history
This commit is contained in:
parent
2c76b6185b
commit
5e4b957fd9
@ -2,15 +2,17 @@
|
||||
import { afterNavigate, goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
const getUri = (url: URL) => url.pathname + url.search + url.hash;
|
||||
|
||||
let position = 0;
|
||||
const history = [$page.url.pathname];
|
||||
const history = [getUri($page.url)];
|
||||
|
||||
$: canGoBack = history.length > 1 && position > 0;
|
||||
$: canGoForward = history.length > 1 && position < history.length - 1;
|
||||
|
||||
afterNavigate((nav) => {
|
||||
if (nav.to === null) return;
|
||||
const to = nav.to.url.pathname;
|
||||
const to = getUri(nav.to.url);
|
||||
if (to === history[position]) {
|
||||
return;
|
||||
} else if (to === history[position + 1]) {
|
||||
|
Loading…
Reference in New Issue
Block a user