This repository has been archived by the owner on Dec 19, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Migrating from 3.x to 4.x
Casey Webb edited this page Dec 5, 2016
·
7 revisions
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...
- ctx.router
- ctx.element
- router.element
- config.persistQuery
- config.persistState
- config.queryStringifier
- config.queryParser
- config.inTransition
- config.outTransition
- ctx.query
- ctx.state
- ctx.hash
- ctx.forceReloadOnParamChange
- ctx.forceReloadOnQueryChange
- ctx.update => router.update
- ctx.isNavigating => router.isNavigating
- ctx.canonicalPath => ctx.fullPath
- 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.