Use history.replaceState instead of setting location.hash (#68)

This commit is contained in:
Olivier Chafik 2024-12-23 02:38:52 +00:00 committed by GitHub
commit 950dc7ec98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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<string> {
return btoa(String.fromCharCode(...new Uint8Array(await new Response(new ReadableStream({