Skip to content

Commit

Permalink
Framework: Prevent reinitializing redux store per route change
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Nov 24, 2015
1 parent 50586ea commit 8e28055
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client/boot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var config = require( 'config' ),
touchDetect = require( 'lib/touch-detect' ),
accessibleFocus = require( 'lib/accessible-focus' ),
TitleStore = require( 'lib/screen-title/store' ),
reduxStore = require( 'lib/redux-store' ),
createReduxStore = require( 'lib/create-redux-store' ),
// The following mixins require i18n content, so must be required after i18n is initialized
Layout,
LoggedOutLayout;
Expand Down Expand Up @@ -79,13 +79,15 @@ function init() {
}

function setUpContext( layout ) {
var reduxStore = createReduxStore();

// Pass the layout so that it is available to all page handlers
// and add query and hash objects onto context object
page( '*', function( context, next ) {
var parsed = url.parse( location.href, true );

context.layout = layout;
context.reduxStore = reduxStore();
context.reduxStore = reduxStore;

// Break routing and do full page load for logout link in /me
if ( context.pathname === '/wp-login.php' ) {
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 8e28055

Please sign in to comment.