Skip to content
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.

Migrating from 3.x to 4.x

Casey Webb edited this page Dec 2, 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...

Added

  • ctx.router
  • ctx.element
  • router.element

Removed

  • config.hashbang (html5-history-api should suffice)
  • config.persistQuery
  • config.persistState
  • config.queryStringifier
  • config.queryParser
  • config.inTransition
  • config.outTransition
  • ctx.canonicalPath
  • ctx.hash
  • ctx.isNavigating
  • ctx.forceReloadOnParamChange
  • ctx.forceReloadOnQueryChange

Moved

  • ctx.update => ctx.router.update

Other changes

  • ctx properties are no longer observable, including route params. If the pathname changes, the page will be torn down and recreated.
  • ctx.canonicalPath has been removed
  • ctx.query and ctx.state have been removed in favor of ko-querystring and ko-history-state; for convenience, you can attach these to ctx in an app middleware and give it scoping using ctx.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.