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

Multiple callbacks when using "then"

Open luke-unifymonitor opened this issue 7 years ago • 4 comments

I'm using "then" to transform the response.

When combined with a refreshInterval it causes multiple requests if the props change.

Example in this code sandbox....

https://codesandbox.io/s/xrzrp27w4q

Click "Foo 1" and it calls api/1 every x seconds Click "Foo 2" and it calls api/2 every x seconds with...but still calls api/1

luke-unifymonitor avatar May 09 '18 16:05 luke-unifymonitor

That code sandbox doesn't seem to be using then or refreshInterval. Your description also doesn't seem to be using then, two clicks. Can you please clarify?

ryanbrainard avatar May 13 '18 23:05 ryanbrainard

Hi Ryan,

Can you have another look? I've placed all the code in index.js now so should be able to see it all from the default view.

https://codesandbox.io/s/xrzrp27w4q

Thanks, Luke

luke-unifymonitor avatar May 14 '18 07:05 luke-unifymonitor

Thanks, definitely some kind of bug there. I haven't gotten a chance to dig into to see exactly what's wrong, but will mark this issue as a bug and will investigate more later (or if someone beats me to it, that's welcome :) )

ryanbrainard avatar May 16 '18 06:05 ryanbrainard

I'm seeing this as well. My workaround was just to use another HOC that transformed the props after.

rjhilgefort avatar Jul 02 '18 17:07 rjhilgefort