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

Feature - throw an error in melody-redux's connect if no store found #68

Merged
merged 3 commits into from
Nov 7, 2018

Conversation

btiwaree
Copy link
Contributor

@btiwaree btiwaree commented Oct 2, 2018

This PR adds an error message that will be thrown when no store is found within findNextStore function.
Currently, the findNextStore function returns null without an error, this causes js errors like Cannot read property 'subscribe' of null or Cannot read property 'getState' of null; this error will provide better context on why the error is being thrown.

P.S. This PR ensues discussions here: #33

@@ -34,6 +34,9 @@ const findNextStore = comp => {
return node.store;
}
}
if (process.env.NODE_ENV !== 'production') {
console.error('Could not find store. Did you forget to provide a store?');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe throw an Error instead of console.error for a better dev experience?

@pago
Copy link
Contributor

pago commented Oct 2, 2018

Awesome! Thanks @btiwaree & @jamesb3ll. Last thing missing: Updating the changelog (we do that manually now for better quality).

@pago pago merged commit 20aa878 into trivago:master Nov 7, 2018
@pago
Copy link
Contributor

pago commented Nov 7, 2018

Thanks again @btiwaree !

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.

3 participants