Skip to content

Commit

Permalink
fix: Read only once
Browse files Browse the repository at this point in the history
  • Loading branch information
franky47 committed Oct 15, 2020
1 parent 2b20d49 commit a09d0a6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/useQueryStates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,19 @@ export function useQueryStates<T extends object>(
// router.pathname includes dynamic route keys, rather than the route itself,
// e.g. /views/[view] rather than /views/my-view
const [asPath] = router.asPath.split(/\?|#/, 1)
const search = query.toString()
const hash = window.location.hash
updateUrl?.call(
router,
{
pathname: router.pathname,
hash: window.location.hash,
search: query.toString()
hash,
search
},
{
pathname: asPath,
hash: window.location.hash,
search: query.toString()
hash,
search
}
)
},
Expand Down

0 comments on commit a09d0a6

Please sign in to comment.