grapher-react icon indicating copy to clipboard operation
grapher-react copied to clipboard

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

Open Sergeeeek opened this issue 7 years ago • 0 comments

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:

https://github.com/cult-of-coders/grapher-react/blob/0d7e8c3795927d9306743f136dad8954aa7d6fe4/lib/withStaticQuery.js#L16-L30

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

Sergeeeek avatar Oct 24 '18 08:10 Sergeeeek