Skip to content
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

Merged
merged 2 commits into from
Feb 9, 2016

Conversation

seear
Copy link
Contributor

@seear seear commented Feb 8, 2016

Before
screen shot 2016-02-08 at 17 59 46

After
screen shot 2016-02-08 at 17 52 26

To Test

  1. Set persist-redux to true in config/development.json
  2. Go to http://calypso.localhost:3000/design and check there is no sidebar-sized gap on the left

When the persist-redux flag is enabled, 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.

/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.

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.
@seear seear added [Feature Group] Appearance & Themes Features related to the appearance of sites. Framework Server Side Rendering labels Feb 8, 2016
@seear seear self-assigned this Feb 8, 2016
@seear seear added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 8, 2016
@@ -79,7 +79,7 @@ export function hasSidebar( state = true, action ) {
case SERIALIZE:
return true;
case DESERIALIZE:
return true;
return state;
Copy link
Contributor

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 :)

@gwwar
Copy link
Contributor

gwwar commented Feb 8, 2016

👍 feel free to merge after you update tests in client/state/ui

And update tests for these fields.
@seear seear added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Feb 9, 2016
@seear
Copy link
Contributor Author

seear commented Feb 9, 2016

@gwwar: thanks for review :)

seear added a commit that referenced this pull request Feb 9, 2016
Framework: Fix logged-out /design render with persistence enabled
@seear seear merged commit d816305 into master Feb 9, 2016
@seear seear deleted the update/ui-persistence branch February 9, 2016 12:25
const state = section( 'hello', {
type: SERIALIZE
} );

expect( state ).to.eql( false );
expect( state ).to.eql( 'hello' );
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants