From 950dc7ec982aa3f6156b9dc67e5b9245264a26c1 Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Mon, 23 Dec 2024 02:38:52 +0000 Subject: [PATCH] Use history.replaceState instead of setting location.hash (#68) --- src/state/fragment-state.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/state/fragment-state.ts b/src/state/fragment-state.ts index 18fb4e4..b613d5d 100644 --- a/src/state/fragment-state.ts +++ b/src/state/fragment-state.ts @@ -9,7 +9,7 @@ export function buildUrlForStateParams(state: State) {//partialState: {params: S return `${location.protocol}//${location.host}${location.pathname}#${encodeStateParamsAsFragment(state)}`; } export async function writeStateInFragment(state: State) { - window.location.hash = await encodeStateParamsAsFragment(state); + history.replaceState(state, '', '#' + await encodeStateParamsAsFragment(state)); } async function compressString(input: string): Promise { return btoa(String.fromCharCode(...new Uint8Array(await new Response(new ReadableStream({