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

When query params are updated new and old data is mixed up in withStaticQuery #30

Open
Sergeeeek opened this issue Oct 24, 2018 · 0 comments

Comments

@Sergeeeek
Copy link

I noticed a bug in withStaticQuery where if you update the query without remounting the component it will still fetch old data and will alternate between new and old data which causes all sorts of problems.

I think it's related to these lines:

componentWillReceiveProps(nextProps) {
const {query} = nextProps;
this.fetch(query);
}
componentDidMount() {
const {query, config} = this.props;
this.fetch(query);
if (config.pollingMs) {
this.pollingInterval = setInterval(() => {
this.fetch(query);
}, config.pollingMs)
}
}

In componentWillReceiveProps interval should be reset and started with a new query from props.

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