When I initially open a static page (haven't tested it with SSR), the trackRouteStart isn't called but the trackRouteComplete is. Because of this ongoingRouteChanges.current becomes -1 and the lib thinks that the isTimeTravelEnabled.current is always true.
This leads to a bug when you change a page, store changes, triggers listenStoreChanges and the locationMismatch sends you to the previous page.
Well, I've fixed only the couse not a reason, but it's always better to have this kind of check, because if the counter becomes negative, then there's definitely something wrong.
But I'd still recommend you to figure out why trackRouteStart doesn't work on the first load.
When I initially open a static page (haven't tested it with SSR), the
trackRouteStart
isn't called but thetrackRouteComplete
is. Because of thisongoingRouteChanges.current
becomes-1
and the lib thinks thatthe isTimeTravelEnabled.current
is always true.This leads to a bug when you change a page, store changes, triggers
listenStoreChanges
and thelocationMismatch
sends you to the previous page.Well, I've fixed only the couse not a reason, but it's always better to have this kind of check, because if the counter becomes negative, then there's definitely something wrong.
But I'd still recommend you to figure out why trackRouteStart doesn't work on the first load.