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

Fix missed case in "observe" type check #2919

Merged
merged 3 commits into from
Apr 8, 2018

Conversation

zerobias
Copy link
Contributor

@zerobias zerobias commented Apr 7, 2018

Redux briefly checks that observer received in observe function is a valid object and throw TypeError with useful user message if is not.
However, it missed null case, as typeof null === 'object' (well-known js issue) and then failed with the obscure error message Cannot read property 'next' of null. I'm sure that there is no reason to not to show the correct error message in all relevant cases
https://github.com/reactjs/redux/blob/master/src/createStore.js#L237

This PR fixes that inconsistency by throwing TypeError with the same useful message in case of null observer

Note that this PR is not a breaking change in any way

@timdorr
Copy link
Member

timdorr commented Apr 8, 2018

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants