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

shouldSubscribe only works when propsToWatch is provided #158

Open
vladbalan opened this issue Mar 15, 2017 · 0 comments
Open

shouldSubscribe only works when propsToWatch is provided #158

vladbalan opened this issue Mar 15, 2017 · 0 comments

Comments

@vladbalan
Copy link

It appears that shouldSubscribe only works as intended when propsToWatch is also provided in the options object, otherwise both currentProps and nextProps are equal to empty objects.

const options = {
  // propsToWatch: ['prop1', 'prop2', 'lastProp'],
  shouldSubscribe(currentProps, nextProps) {
    console.log('nextProps', nextProps); // returns {}
    console.log('currentProps', currentProps); // returns {}
  },
};

If propsToWatch is not provided, it defaults to null (

propsToWatch = null, // Watch all the props.
) and pick(props, null) === {} (
const nextProps = pick(props, propsToWatch);
).

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

1 participant