diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-08-22 22:59:03 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-08-23 11:11:03 +0200 |
commit | d5eec54c72b755522addc4a839810971ba24f813 (patch) | |
tree | b3f9c1bfde7f4ebd9d2ddca54afa67783c19d983 /sandstorm.js | |
parent | f315ee443061c916dc55b291bfe79503fa5e952f (diff) | |
download | wekan-d5eec54c72b755522addc4a839810971ba24f813.tar.gz wekan-d5eec54c72b755522addc4a839810971ba24f813.tar.bz2 wekan-d5eec54c72b755522addc4a839810971ba24f813.zip |
Start the migration from iron-router to flow-router
Motivations:
* Iron-Router foces us to use Tracker.nonreactive black magic in order
to avoid un-necessary re-renders;
* There is a community consensus (supported by some MDG members) that
the flow-router API is easier to reason about;
* The useraccounts now supports flow router (that was a blocking
element when I considered the switch ~3months ago)
On the server we use the Picker router, as encouraged by the Kadira
team (which develop both Flow and Picker routers).
In the current state of things there are some bugs related to the
missing Loading architecure. Previously onRendered callback where
always called when the data the component needed was available, now
we have to handle this ourselves, which we will in a following commit.
Diffstat (limited to 'sandstorm.js')
-rw-r--r-- | sandstorm.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sandstorm.js b/sandstorm.js index b2b4d88b..d565df62 100644 --- a/sandstorm.js +++ b/sandstorm.js @@ -30,23 +30,23 @@ if (isSandstorm && Meteor.isServer) { // Redirect the user to the hard-coded board. On the first launch the user // will be redirected to the board before its creation. But that’s not a // problem thanks to the reactive board publication. We used to do this - // redirection on the client side but that was sometime visible on loading, + // redirection on the client side but that was sometimes visible on loading, // and the home page was accessible by pressing the back button of the // browser, a server-side redirection solves both of these issues. // // XXX Maybe sandstorm manifest could provide some kind of "home url"? - Router.route('/', function() { - var base = this.request.headers['x-sandstorm-base-path']; + Picker.route('/', function(params, request, response) { + var base = request.headers['x-sandstorm-base-path']; // XXX If this routing scheme changes, this will break. We should generation // the location url using the router, but at the time of writting, the // router is only accessible on the client. var path = '/boards/' + sandstormBoard._id + '/' + sandstormBoard.slug; - this.response.writeHead(301, { + response.writeHead(301, { Location: base + path }); - this.response.end(); - }, { where: 'server' }); + response.end(); + }); // On the first launch of the instance a user is automatically created thanks // to the `accounts-sandstorm` package. After its creation we insert the |