Migrating from 3.x to 4.x - Profiscience/ko-component-router GitHub Wiki
While the concept of ko-component-router remains the same, much has changed internally, which means a few breaking changes. Here are the notable changes...
Added
- ctx.router
- ctx.element
- router.element
Removed
- config.persistQuery
- config.persistState
- config.queryStringifier
- config.queryParser
- config.inTransition
- config.outTransition
- ctx.query
- ctx.state
- ctx.hash
- ctx.forceReloadOnParamChange
- ctx.forceReloadOnQueryChange
Moved
- ctx.update => router.update
- ctx.isNavigating => router.isNavigating
- ctx.canonicalPath => ctx.fullPath
Other changes
- ctx properties are no longer observable, including route params. If the pathname changes, the page will be torn down and recreated.
- ctx.query has been removed in favor of ko-querystring; for convenience, you can attach this to
ctx
in an app middleware and give it scoping usingctx.router.depth
, but be aware the APIs for these libs are not the same as before. Gone are the days of.get()
, hello ES6 proxies. - ctx.state is gone, however I can add it as a separate package if there is demand. We moved away from using it, preferring to create model and collection files to manage our data. If you use/need state, file an issue and I can whip something up, I just don't want to waste a bunch of time on something that isn't used by myself or others.