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); }