Skip to content

Commit

Permalink
Merge pull request #674 from contember/routing-fix
Browse files Browse the repository at this point in the history
routing pushState fix
  • Loading branch information
matej21 committed Mar 8, 2024
2 parents 0e23dbc + b3e9504 commit d0bd991
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react-routing/src/RequestContext.tsx
Expand Up @@ -44,7 +44,11 @@ export const RequestProvider: FC<{ children: ReactNode }> = ({ children }) => {
const pushRequest = useCallback(
(request: RequestState) => {
setRequest(request)
window.history.pushState({}, document.title, requestStateToPath(routing, request))
const newUrl = requestStateToPath(routing, request)
if (newUrl === window.location.pathname + window.location.search) {
return
}
window.history.pushState({}, document.title, newUrl)
},
[routing],
)
Expand Down

0 comments on commit d0bd991

Please sign in to comment.