Skip to content

Commit 50272dc

Browse files
committed
Don't put random ids in history.state because they break on page reloads
1 parent 6103c78 commit 50272dc

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

frontend/viewer/src/lib/utils/back-handler.svelte.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ export interface BackHandlerConfig {
2020
class BackHandler {
2121
static #ignorePopstate = false;
2222
static #backStack: BackHandler[] = [];
23-
readonly #id = crypto.randomUUID().split('-')[0];
2423
private get fullKey() {
25-
return `BackHandler-${this.#id}-${this.config.key}`;
24+
return `BackHandler-${this.config.key}`;
2625
};
2726

2827
constructor(private config: BackHandlerConfig) {
@@ -34,7 +33,6 @@ class BackHandler {
3433
void queueHistoryChange(() => history.pushState({
3534
backHandler: true,
3635
key: this.config.key,
37-
id: this.#id,
3836
}, ''), this.fullKey);
3937
} else {
4038
this.remove();

frontend/viewer/src/lib/utils/url.svelte.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ export class QueryParamState {
2121
return this.#current;
2222
}
2323

24-
readonly #id = crypto.randomUUID().split('-')[0];
2524
private get fullKey() {
26-
return `QueryParamState-${this.#id}-${this.config.key}`;
25+
return `QueryParamState-${this.config.key}`;
2726
};
2827

2928
#waitingForHistoryChange: boolean = false;

0 commit comments

Comments
 (0)