While the release is correctly versioned as a new major release, some of the breaking changes are missing from the official changelog:
history.listen() API changed. The callbacks are now called with an an object of shape Update instead of Location. This breaks react-router <=5.createLocation() was droppedlocationsAreEqual() was droppedhistory.push() now has a different exception handling for iOS (page reload and loss of state)createPath() no longer ensures the hash and search portions are properly prefixed before concatination.history.location is now frozenparsePath changed the handling of falsey values. v5 now returns just an empty object.key on the default location changed from being not defined to being defined and having the value "default".push("#hash") will no longer clear the search part of the location. This is the default browser behavior, but could still be seen as a breaking change.history.goBack() was renamed to history.back()history.forward() was renamed to history.forward()@types/history. If you depend on the latter, installing history@5 will result in a build failure (see #846, #835)And the changes of the blocking features are mentioned, but not under "breaking" and not in detail:
Not breaking, but also not documented:
key attribute on locations was increased from 6 to 8.key now works with createHashHistory as well.(See also: #810, #809, #803, #813, and #829 )
Addendum: I'm not sure I found all the breaking changes. But appending the changelog by my findings could help people who use history directly to make an upgrade decision and find code they need to change on their end regardless.
Addendum 2: I scribbled together slightly more coherent notes on all the breaking changes. It's still incomplete and very basic, but it might help. Please comment on the gist if I got anything wrong or if you have suggestions.
history.location object is now frozen
parsePath can be used as a replacement for createLocation
parsePath can be used as a replacement for createLocation
I don't really see that. createLocation was quite the powerful function for calculating route changes. parsePath just splits the string according to spec.
But your comment just made me notice that parsePath changed behavior between versions too.
I just noticed that some of these breaking changes are also points on the roadmap (#689). @mjackson You might want to update that one as well.
createHashHistory result now has incompatible types when used as custom history provider for preact-router.
So what, are you guys just gonna leave this issue here, without addressing the fact that you shipped a ton of breaking changes without telling us? At least comment on it and tell us how to fix our projects now.
So what, are you guys just gonna leave this issue here, without addressing the fact that you shipped a ton of breaking changes without telling us? At least comment on it and tell us how to fix our projects now.
I am sure they have seen the thread, but, I agree, an acknowledgement would be nice. However, don't go around demanding stuff. If this upgrade breaks your project report what's breaking, subscribe to this thread for updates, and in the meantime revert to v4. That's how it works.
@mkarajohn maybe you are right, perhaps I'm being too demanding. But just because maintainers are doing their job voluntarily does not mean they can't be held accountable for ignoring such an important issue for, what, two and a half months now?
Especially when it comes to such a fundamental and widely used library as history.
@shakhbulatgaz I understand your frustration, v5 is unusable for me too, as it currently stands, however it's not the end of the world. I am just staying on v4 a while longer
Most helpful comment
@shakhbulatgaz I understand your frustration, v5 is unusable for me too, as it currently stands, however it's not the end of the world. I am just staying on v4 a while longer