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

Slight improvement to the 'no hydrated stores' error #605

Merged
merged 5 commits into from
Dec 1, 2016
Merged

Slight improvement to the 'no hydrated stores' error #605

merged 5 commits into from
Dec 1, 2016

Conversation

cookiefission
Copy link
Contributor

@cookiefission cookiefission commented Nov 15, 2016

Hi,

When I was trying to set up server side rendering, I ran into the 'no hydrated stores' error. After some digging, I realised I hadn't called redux_store_hydration_data anywhere in my view.

This should hopefully make it more clear that rendering redux_store_hydration_data is required.

Thanks


This change is Reviewable

This should make it more clear that rendering
`redux_store_hydration_data` is required.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 82.987% when pulling 14e8195 on cookiefission:improve/no-hydrated-stores-error into 447c4eb on shakacode:master.

@justin808
Copy link
Member

Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion.


node_package/src/StoreRegistry.js, line 46 at r1 (raw file):

        "redux_store near the top of your controller action's view (not the layout) " +
        'and before any call to react_component or you do not render ' +
        '`redux_store_hydration_data` anywhere on your page';

@cookiefission this is awesome. Can you try this out with a \n to clearly delineate the "ands" and the "or".


Comments from Reviewable

This should more cleanly differentiate the two cases
@cookiefission
Copy link
Contributor Author

image

This is the error now. Is that what you were after?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 82.987% when pulling 3c0f9a2 on cookiefission:improve/no-hydrated-stores-error into 447c4eb on shakacode:master.

@justin808
Copy link
Member

Please see my suggestion.

Try replacing and see if you like it.


Reviewed 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


node_package/src/StoreRegistry.js, line 46 at r1 (raw file):

Quoted 5 lines of code…

  const msg = 'There are no stores hydrated and you are requesting the store ' +
    `${name}. This can happen if you are server rendering and either \nyou do not call ` +
    "redux_store near the top of your controller action's view (not the layout) " +
    'and before any call to react_component \nor you do not render ' +
    'redux_store_hydration_data anywhere on your page';
  const msg = `There are no stores hydrated and you are requesting the store ${name}.

This can happen if you are server rendering and either:

  1. You do not call redux_store near the top of your controller action's view (not the layout)
    and before any call to react_component.
  2. You do not render redux_store_hydration_data anywhere on your page.`

Comments from Reviewable

@justin808 justin808 modified the milestone: 6.2 Nov 19, 2016
@coveralls
Copy link

Coverage Status

Coverage remained the same at 82.987% when pulling 1095759 on cookiefission:improve/no-hydrated-stores-error into 447c4eb on shakacode:master.

@justin808
Copy link
Member

Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion.


node_package/src/StoreRegistry.js, line 46 at r1 (raw file):

const msg = `There are no stores hydrated and you are requesting the store ${name}.

This can happen if you are server rendering and either:

  1. You do not call redux_store near the top of your controller action's view (not the layout)
    and before any call to react_component.
  2. You do not render redux_store_hydration_data anywhere on your page.`

Hey the formatting got skewered in my prior comment, @cookiefission

  const msg = 
`There are no stores hydrated and you are requesting the store ${name}.
This can happen if you are server rendering and either:
1. You do not call redux_store near the top of your controller action's view (not the layout)
and before any call to react_component.
2. You do not render redux_store_hydration_data anywhere on your page.`

Notice there are backticks around the whole string.
You can have embedded returns in the backtick strings.


Comments from Reviewable

@justin808
Copy link
Member

I updated my comment. Please use backticks.


Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@justin808
Copy link
Member

Reviewed 1 of 1 files at r3.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@justin808 justin808 modified the milestones: 6.2, 6.3.0 Nov 19, 2016
@coveralls
Copy link

Coverage Status

Coverage remained the same at 82.987% when pulling 696043a on cookiefission:improve/no-hydrated-stores-error into 447c4eb on shakacode:master.

@justin808
Copy link
Member

@cookiefission Did you try this out? You indented the lines, and the indents will be part of the message. I don't think you want the indents. Please paste a screenshot of how the message prints out.

@cookiefission
Copy link
Contributor Author

image

This is how the error appears now. The 1. ... l goes on to another line because if I didn't do that, the line of code would go over 120 chars. I can change that if you want.

Also, when this is good to go, do you want me to squash the commits down or not?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 82.987% when pulling 50e8ee3 on cookiefission:improve/no-hydrated-stores-error into 447c4eb on shakacode:master.

@justin808 justin808 merged commit 843c43d into shakacode:master Dec 1, 2016
@justin808
Copy link
Member

Thanks @cookiefission!

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

Successfully merging this pull request may close these issues.

3 participants