Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lib/SkHistoryApi.svelte.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ const hoistedVars = vi.hoisted(() => ({

vi.mock(import("$app/state"), async (importOriginal) => {
return {
...importOriginal,
...await importOriginal(),
page: {
get url() {
return hoistedVars.urlMock();
return hoistedVars.urlMock() ?? new URL("http://localhost/");
},
get state() {
return hoistedVars.stateMock();
}
},
} as Page
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/lib/SkHistoryApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class SkHistoryApi implements HistoryApi {
if (browser && !isConformantState(page.state)) {
// I tried with replaceState() here, throws with error "cannot use before router initializes".
// So, using goto() with replaceState: true. This triggers an update on page.url, though.
goto('', { replaceState: true, state: { path: page.state, hash: {} } });
goto(page.url.toString(), { replaceState: true, state: { path: page.state, hash: {} } });
}
}

Expand Down