Skip to content

Commit

Permalink
fluxible-router: remove currentNavigate.route from dehydrated state (#…
Browse files Browse the repository at this point in the history
…670)

Besides avoiding unnecessary data to be sent to the client (given that
RouteStore currently doesn't need currentNavigate.route to
re-hydrate), we prevent browsers to break given that
currentNavigate.route.action and currentNavigate.route.handler may
contain server transpiled code that is not compatible with them.
  • Loading branch information
pablopalacios committed Nov 17, 2020
1 parent e283016 commit 42fcb3c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/fluxible-router/lib/RouteStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ var RouteStore = createStore({
dehydrate: function () {
// no need to dehydrate this._prevNavigate, because it will always
// be null on server request
var currentNavigate = Object.assign({}, this._currentNavigate, {route: null});
return {
currentNavigate: this._currentNavigate,
currentNavigate: currentNavigate,
routes: this._routes
};
},
Expand Down
1 change: 1 addition & 0 deletions packages/fluxible-router/tests/unit/lib/RouteStore-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('RouteStore', function () {
expect(state.currentNavigate.transactionId).to.equal('first');
expect(state.currentNavigate.url).to.equal('/foo');
expect(state.currentNavigate.method).to.equal('get');
expect(state.currentNavigate.route).to.equal(null);
expect(state.routes).to.equal(null);
});
});
Expand Down

0 comments on commit 42fcb3c

Please sign in to comment.