Skip to content

Commit 56b3e06

Browse files
committed
fix: ensure browser updates are performed when there are no query params
1 parent 284bf00 commit 56b3e06

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/core/src/lib/adapters/browser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export function browser(options: BrowserAdapterOptions = {}): Adapter {
2828
isBrowser: () => typeof window !== "undefined",
2929
browser: {
3030
read: () => windowObj.location,
31-
save: (search, hash) => update(null, "", `${search}${hash}`),
31+
save: (search, hash) =>
32+
update(null, "", `${search.length ? search : "?"}${hash}`),
3233
},
3334
server: {
3435
save: () => {},

packages/core/src/lib/adapters/sveltekit.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export function sveltekit(options: SvelteKitAdapterOptions = {}): Adapter {
2323
return window.location;
2424
},
2525
save(search, hash) {
26-
goto(`${search}${hash}`, {
26+
const searchString = search.length ? search : "?";
27+
goto(`${searchString}${hash}`, {
2728
keepFocus: true,
2829
noScroll: true,
2930
replaceState: replace,

0 commit comments

Comments
 (0)