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

Unexpected key found in previous state received by reducer #38

Closed
jormaj opened this issue Apr 8, 2016 · 7 comments
Closed

Unexpected key found in previous state received by reducer #38

jormaj opened this issue Apr 8, 2016 · 7 comments

Comments

@jormaj
Copy link

jormaj commented Apr 8, 2016

Hi,

First of all: thanks for this useful boilerplate, great to get me started!

While trying to wrap my head around everything that is going on, I noticed that upon loading one of the posts pages directly (f.ex. http://localhost:5000/post/you-smart-you-loyal), the console spits out the following warning:

Unexpected key "currentPost" found in previous state received by the reducer. Expected to find one of the known reducer keys instead: "posts". Unexpected keys will be ignored.

When I reach the page by clicking on the link on the homepage, this warning does not appear.

Is this by design? Does this boilerplate assume there is always a single point of entry?

@jaredpalmer
Copy link
Owner

So it's actually just a warning message. You can read more about it here: http://stackoverflow.com/questions/32968016/how-to-dynamically-load-reducers-for-code-splitting-in-a-redux-application

@benbonnet
Copy link

you mean this is a bug that could be fixed on the next releases of redux; nothing critical here ?

@jaredpalmer
Copy link
Owner

that is correct

@benbonnet
Copy link

👍

@neekey
Copy link

neekey commented Aug 8, 2016

@jaredpalmer it's not just a warning, the reducer actually cleans up all the unexpected keys ...

@jaredpalmer
Copy link
Owner

@neekey I asked Dan about this a few months ago and he said it was in fact a warning not an error (despite being coded as an error). Feel free to submit a PR with a fix if you have time to dig deeper.

@totymedli
Copy link

This message can appear when you do SSR and forgot to recompile the server side bundle, so it still works with the old reducers and generate the old state that createStore reads. Read more in this post.

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

No branches or pull requests

5 participants