Match route before init stores (#698)

This commit is contained in:
Carl Törnqvist
2019-06-12 13:42:18 +02:00
committed by GitHub
parent b373c7ee06
commit a871818d32
3 changed files with 43 additions and 2 deletions
+2 -2
View File
@@ -142,11 +142,11 @@ Choo.prototype.start = function () {
}
this._setCache(this.state)
this._matchRoute()
this._stores.forEach(function (initStore) {
initStore(self.state)
})
this._matchRoute()
this._tree = this._prerender(this.state)
assert.ok(this._tree, 'choo.start: no valid DOM node returned for location ' + this.state.href)
@@ -220,11 +220,11 @@ Choo.prototype.toString = function (location, state) {
var self = this
this._setCache(this.state)
this._matchRoute(location)
this._stores.forEach(function (initStore) {
initStore(self.state)
})
this._matchRoute(location)
var html = this._prerender(this.state)
assert.ok(html, 'choo.toString: no valid value returned for the route ' + location)
assert(!Array.isArray(html), 'choo.toString: return value was an array for the route ' + location)