mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
fix router setLocation
This commit is contained in:
parent
94228561b1
commit
adbb5fca95
@ -72,7 +72,16 @@ export const InternalRouter = withRouter((props) => {
|
||||
window.app.eventBus.emit("transitionDone", event)
|
||||
})
|
||||
|
||||
props.history.setLocation = (to, state, delay) => {
|
||||
props.history.setLocation = (to, state = {}, delay = 150) => {
|
||||
// clean double slashes
|
||||
to = to.replace(/\/{2,}/g, "/")
|
||||
|
||||
// if state is a number, it's a delay
|
||||
if (typeof state !== "object") {
|
||||
delay = state
|
||||
state = {}
|
||||
}
|
||||
|
||||
const lastLocation = props.history.lastLocation
|
||||
|
||||
if (typeof lastLocation !== "undefined" && lastLocation?.pathname === to && lastLocation?.state === state) {
|
||||
@ -91,7 +100,6 @@ export const InternalRouter = withRouter((props) => {
|
||||
}, state)
|
||||
|
||||
props.history.lastLocation = window.location
|
||||
|
||||
}, delay ?? defaultTransitionDelay)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user