Problem with refetchInterval #399
-
Hello, was wondering if someone could help me figure out what's going on. I've tried to reproduce it on the codesandbox bellow. It's supposed to poll an API every 1s but it doesn't (see it on the console). I'm guessing it's because the I'm sure I'm just misunderstanding something here but would be nice to understand what's going on. Thanks for the help! codesandbox: |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
When the interval amount changes, it cancels the previously pending interval and starts a new one, so if your interval amount is changing faster than the interval time itself, it will never fire. |
Beta Was this translation helpful? Give feedback.
-
Beyond that, if you aren't changing the interval itself, then this could be a bug. |
Beta Was this translation helpful? Give feedback.
-
@tannerlinsley thanks! yea, the interval it's not changing just the component getting re-rendered due to another unrelated prop changing. If you get some time check the code-sandbox. Maybe it's a bug then. |
Beta Was this translation helpful? Give feedback.
-
I checked the codesandbox example and confirm that something weird is going on, when parent rerenders often. |
Beta Was this translation helpful? Give feedback.
I checked the codesandbox example and confirm that something weird is going on, when parent rerenders often.
Will look into this later.