-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Framework: Fix logged-out /design render with persistence enabled #3167
Conversation
When the `persist-redux` flag is on, redux state bootstrapped from the server (on the logged-out /design route) is passed through the DESERIALIZE actions. This change preserves the state passed through those actions for `section` and `hasSidebar`, which are the two fields needed for the client render of logged-out /design.
@@ -79,7 +79,7 @@ export function hasSidebar( state = true, action ) { | |||
case SERIALIZE: | |||
return true; | |||
case DESERIALIZE: | |||
return true; | |||
return state; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to update the related tests :)
👍 feel free to merge after you update tests in |
And update tests for these fields.
@gwwar: thanks for review :) |
Framework: Fix logged-out /design render with persistence enabled
const state = section( 'hello', { | ||
type: SERIALIZE | ||
} ); | ||
|
||
expect( state ).to.eql( false ); | ||
expect( state ).to.eql( 'hello' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:) Might make more sense to change this to a boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might make more sense to change this to a boolean.
section
can be a string ('design', 'reader' etc) or false
, so I think the string is ok, or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I forgot we mixed types here! :) This is fine.
Before
After
To Test
persist-redux
totrue
inconfig/development.json
When the
persist-redux
flag is enabled, redux state bootstrapped from the server (on the logged-out /design route) is passed through theDESERIALIZE
actions. This change preserves the state passed through those actions forsection
andhasSidebar
, which are the two fields needed for the client render of logged-out /design./cc @gwwar
An alternative to tweaking the
DESERIALIZE
actions would be to merge in the bootstrapped state after deserialization. The downside to that approach being that we would not be taking advantage of the immutable conversions.