Skip to content

Commit

Permalink
fix(atomWithLocation): replaceState function to use window.history.st…
Browse files Browse the repository at this point in the history
…ate instead of null (#33)

* Update atomWithLocation replaceState to use window.history.state instead of null

* Update CHANGELOG.md
  • Loading branch information
Flirre authored Mar 11, 2024
1 parent cf8a8e4 commit 9aba6f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/atomWithLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 9aba6f6

Please sign in to comment.