From 9aba6f62cd4834813d1eae8bb56be33018f85956 Mon Sep 17 00:00:00 2001 From: Filip Lindahl Date: Mon, 11 Mar 2024 09:24:43 +0100 Subject: [PATCH] fix(atomWithLocation): replaceState function to use window.history.state instead of null (#33) * Update atomWithLocation replaceState to use window.history.state instead of null * Update CHANGELOG.md --- CHANGELOG.md | 3 ++- src/atomWithLocation.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16a93aa..5a28b50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Change Log ## [Unreleased] -- feat(atomWithLocation): support location.hash +- feat(atomWithLocation): support location.hash #30 +- fix(atomWithLocation): replaceState function to use window.history.state instead of null #33 ## [0.5.4] - 2024-02-27 ### Changed diff --git a/src/atomWithLocation.ts b/src/atomWithLocation.ts index 102b01e..d395e38 100644 --- a/src/atomWithLocation.ts +++ b/src/atomWithLocation.ts @@ -33,7 +33,7 @@ const applyLocation = ( url.hash = location.hash; } if (options?.replace) { - window.history.replaceState(null, '', url); + window.history.replaceState(window.history.state, '', url); } else { window.history.pushState(null, '', url); }