- Fix a broken release, for some reason the
npm run release
failed to package correctly
- Make it possible to
transitionTo('anAbstractRoute')
andgenerate('anAbstractRoute')
in cases where the abstract route has a corresponding index route. This can be more intuitive in some cases.
- URL encode slashes in route params
- Don't intercept clicks on
mailto:
links
- Fix: stop using Array.prototype.find which is not available in older browsers
- Add router.isActive method for testing if a given route is currently active. See docs
- Parse query params when transitioning even when no route matches
Nothing changed from v2.0.0-rc4.
- BrowserLocation and HistoryLocation can now be accessed at cherrytree.BrowserLocation and cherrytree.MemoryLocation again. This is to make it easier to use those modules for UMD users (#116).
Breaking changes:
HistoryLocation
has been renamed toBrowserLocation
. Location in cherrytree is the place that stores the current location of the app. Location is updated with the new path when cherytree transitions. Location also triggers updates when someone changes the location externally (e.g. by navigating with back/forward buttons or updating the URL).BrowserLocation
is a more apt name since this location implementation represents browser's location bar and is configurable to use pushState or hashchange. This way, the other location that ships with cherrytree,MemoryLocation
- also makes more sense, in this case we're saying the URL is simply stored in this in memory object and not really connected to the browser (which is what makes it useful on the server, for example).
- Fix: query params were stringified incorrectly when more than 2 params and when some of params were undefined.
router.generate('/a/b/c', {}, { id: 'def', foo: 'bar', baz: undefined })
results in/a/b/c?id=def&foo=bar
now as in the older versions of cherrytree.
Breaking changes:
- Every route is now routable. Previously it was only possible to generate links and transition to leaf routes. This simplifies the typical usage of the router and opens up new use cases as well. For example, if you want to redirect from '/' to '/some/:id', it's now easier to implement this kind of redirect behaviour without needing to create many reduntant '.index' routes.
- The special
.index
treatment has been removed. Previously, if the route name ended with.index
, the path was automatically set to ''. Now, such path will default to 'index' as with all other routes. Setpath: ''
on your index routes when upgrading. - An exception is now thrown when multiple routes have the same URL pattern.
- Given all the above changes - a new route option
abstract: true
was introduced for making non leaf routes non routable. This also solves the problem where usingpath: ''
would result in multiple routes with the same path. - The
paramNames
array (e.g. ['id', 'filter']) was replaced withparams
object (e.g. {id: 1, filter: 'foo'}) in the route descriptor on the transition object. - The
ancestors
attribute was removed from the route descriptor. - Switching between using
history
andmemory
locations has been simplified. Previously, you'd need to passnew MemoryLocation(path)
when callinglisten
. Now, specify the location to use withlocation: 'memory'
when creating the router and pass the path when callinglisten
. - The
qs
module was removed from dependencies and was replaced with a tiny, simple query string parser. This can be sufficient for a lot of applications and saves a couple of kilobytes. If you want to useqs
or any other query parsing module, pass it asqs: require('qs')
option to the router. - params, query and route array are now immutable between transitions, i.e. modifying those directly on the transition only affects that transition
- Drop out-of-the-box support for ES3 environments (IE8). To use Cherrytree in older environments - es5 polyfills for native
map
,reduce
andforEach
need to be used now. - An undocumented, noop function
reset
was removed from the router.
New features:
- Support for custom click intercept handlers
Under the hood improvements:
- Update all dependencies to the latest versions
- Tests are being run in more browsers now
- Replaced
co
withbabel-creed-async
in tests - Removed the dependency on
lodash
Documentation:
- Moved docs back to a separate
docs/api.md
file - Documented router.matchers
- Documented 404 handling
- BYOP - Cherrytree now requires a global Promise implementation to be available or a Promise constructor passed in as an option
- Add
transition.redirectTo
so that middleware could initiate redirects without having the router
- Log errors by default (i.e. options.logError: true by default)
- Fix router.destroy() - DOM click events for link interception are now cleaned up when router.destroy() is called
- Add server side support
- events.js now exports an {} object on the server instead of crashing due to missing
window
- MemoryLocation correctly handles option flags and can be instantiated with a starting
path
- events.js now exports an {} object on the server instead of crashing due to missing
- Add a server-side-react example
- When transition is rejected with a
TransitionRedirected
error - theerr.nextPath
is now available)
- Fix dependencies - lodash was declared as a devDependency
- Fix the URL generation when
pushState: true
and root !== '/'
A brand new and improved cherrytree!
See https://github.com/QubitProducts/cherrytree/tree/677f2c915780d712968023b8d24306ff787a426d