Skip to content

7.2.0

@AlexGalays AlexGalays released this · 7 commits to master since this release

ReactState changes only :

  • Use React 0.14
  • Redirect hook
  • Fix the case where a parent already has a default state with just a query string

Downloads

7.1.0

@AlexGalays AlexGalays released this · 15 commits to master since this release

  • Pass the router instance as the third argument of all state callbacks
  • Fix anchor interception when using # mode
  • Add Router->findState
  • addon/ReactState: Set a key on every Component instance managed by ReactState so that they play nicely with ReactTransitionGroup.

Downloads

7.0.10

@AlexGalays AlexGalays released this · 16 commits to master since this release

  • Fix router.link when using # based urls
  • Fix ReactState addon: Default states didn't get their parent's set

Downloads

7.0.8

@AlexGalays AlexGalays released this · 20 commits to master since this release

  • Fix addon/ReactState issue where a default state was added even when there was already one declared.

Note: The versions between 7.0.3 and 7.0.8 should be ignored. They were temporary failed attempts at migrating and publishing an ES6 codebase without a dependency on a particular transform technology (namely browserify).

Downloads

7.0.3

@AlexGalays AlexGalays released this · 27 commits to master since this release

  • Partial ES6 rewrite
  • Rely on grunt less, now using it only to run tests
  • Optional React addon : Syntactic sugar for hierarchical states.

Downloads

7.0.1

@AlexGalays AlexGalays released this · 35 commits to master since this release

  • Parent states can be transitioned to (was restricted to leaf states before)
  • Stricter state tree building: Sibling states can not have the same path; there can't be any ambiguous path at init time.

Downloads

Lucky 7.0.0

@AlexGalays AlexGalays released this · 41 commits to master since this release

refactoring / cleanup

After using abyssa in 3 production projects, insight have be gained, its usage, pros and cons better understood. This release contains many breaking changes, although it doesn't take long to refactor a codebase to it as the fundations are unchanged (See the demo-app 7.0.0 upgrade commit).

Removed most dependencies

  • The dependency on crossroads is removed; While it was a time saver initially, abyssa used very few functionalities of that router and the integration with it was awkward.
  • The dependency on js-signals is removed; while I still think signals are generally superior to events, that implementation didn't particularly shine compared to regular string based events people are used to. (strange public API, no signal merging, broken addOnce, etc) Instead, abyssa now has a dependency on events, a node-like EventEmitter lib also used by browserify.
  • The dependency on Q is removed; The async wrapping functionality is kept but now relies (optionally, if the functionality is used) on native promises (whether shimmed or not)

As a result, abyssa is now 12kb instead of 39kb when minified and easier to maintain.

Synchronous transitions

Async transitions did not achieve much and were a source of tricky bugs. Applications navigating immediately on user gesture (perhaps showing some default state) then fetching their data are more common than applications blocking the world before all the data is retrieved for the next screen (although this can still be done, just with different techniques).

router.transitionTo(state) now performs the transition synchronously. This removes a lot of complexity from the router, error reporting is better and so is debugging.

API cleanup

States as POJOS

Before, you could only add State instances to the router. These special State objects were a bit confusing and mixed private and public concerns.
A state or route is now a POJO (Plain Old Javascript Object), making it easier to manipulate/compose.

var state = {
  uri: 'missions/:id',
  enter: function() {},
  exit: function() {},
  children: {} 
};

The State function now is just a factory that returns a state POJO:

var state = State('missions/:id', { enter: function() {}, exit: function() {} }, {});

StateWithParams

These objects exposed in event handlers and router.current, router.previous now have the following API:

uri, params, name, fullName, data, isIn

An accumulator/context object is passed during transitions

States taking part in a transition can leave data in the context object then later read it back.
Abyssa provides an object for each transition but you can also pass your own via transitionTo.

router.transitionTo('some.state', { id: '33' }, { myData: 666 });

// In the first state to participate in the transition: 

function enter(params, context) {
   // context is { myData: 666 }
   context.fyi = 777;
}

// in another state:  

function enter(params, context) {
  // context is { myData: 666, fyi: 777 }
}

Renaming

  • router.state to router.transitionTo
  • router.currentState to router.current
  • router.previousState to router.previous
  • Abyssa.Async to Abyssa.async

Router API cleanup

The following router APIs, rarely used, redundant or dangerous were removed:

  • path, query, params, reload, redirect, 'urlSync=false'.

Removed typecasting

Before, url params were typecasted: A state with the uri missions/:id would match the uri "missions/33" and the id param would be 33, not '33'. This is a dangerous thing to do, for instance there is no way to know whether '12e33' should be typecasted to a Number or to a String. All params are now Strings, always, as the user knows best how to interpret them.

Signals

There were numerous signals, most of them never needed.
There are now only two events:

router.transition.on('started') and router.transition.on('ended')

CommonJS cyclic dependencies

The router needs to know the states, the states need to know about the router for its public API (especially for navigation and reverse routing); This could create cyclic dependencies in simple module systems like CommonJS'.
This cycle can now be broken by using require('abyssa').api in states instead of importing the router instance.

Downloads

6.6.0

@AlexGalays AlexGalays released this · 75 commits to master since this release

  • (Breaking change) Cleanup StateWithParams: Delete duplicated properties that were also found in the state. The following properties must now be accessed from stateWithParams.state: name, fullName, data.

  • Add router utils: path(), query(), params(), queryParams(), paramsDiff()

  • Add an option to customise the hash (e.g, so #! can be used)

  • Fix hashMode's initial path query when there is no # in the url yet

Downloads

6.5.0

@AlexGalays AlexGalays released this · 85 commits to master since this release

When navigating to a state using name plus params or when reverse-routing, encode the passed params.

Downloads

Something went wrong with that request. Please try again.