Bug when using stored refetch function #3600
Comments
When you say "later", how much later do you mean? Does the component unmount and remount before you call |
@dylanwulf Thanks for the fast response. It's actually working now. I'm not entirely sure what changed but maybe it was just some kind of npm / node_modules / packages problem. |
FYI to anyone who comes here. I'm seeing the error again but I fixed it by adding the following to the bottom of my effect:
|
I had to restart my iOS simulator to get this working again. Maybe a Fast Refresh issue. |
I can confirm that this happens with fast refresh every once in a while. |
this happens to me during my infinite scroll scroll view |
The issue was present only when fast refreshed was enabled |
This should be reopened no? Calling refetch with React Fast Refresh enabled is causing this bug, and it's something I'm sure more and more people will be running into soon. |
@stevelizcano I suggest you make a new bug if you're seeing an issue with Fast Refresh. I just reproduced this bug again this morning, and it is not related to fast refresh. It seems to be fixed by my suggested fix above. |
Same here. Fails with fast refresh on react-native |
Same here, and seems related to fast refresh for me as well. Could we reopen this?? |
There appears to be a bug around fast refresh, but this issue is for another bug. I suggest you open a new issue. |
Hi everyone. useEffect(() => {
refetch();
}, []); Also do not forget to use empty brackets [] as a second argument to prevent it to execute multiple times. Hope this helps. |
This is happening to us in production, so obviously in our case, fast refresh is not a relevant possible cause for us. We are using react-native, react-apollo: ^3.1.3 => 3.1.3 |
happening to us as well. react-apollo: 3.1.3 we are trying to refetch using sth like But it is now easy to reproduce(intermittent problem) clearly this is not working |
Intended outcome:
No crashes when executing the following code. I'm storing a reference to the refetch function, and attempting to call it later. I've tried it in both an HOC and in a hook. This code used to work for
react-apollo:3.0.0-beta.3
, but is crashing since I updated to the newest version.The refetch function works fine when called normally, and not saved as a reference in a closure. Which leads me to believe it's perhaps some issue related to the recent logic changed on how refetch works? @hwillson #3422 #3339
HOC:
or hook:
-->
Actual outcome:
App crashes with:
How to reproduce the issue:
I'm not exactly sure what is needed to reproduce. I'm just trying to call refetch.
Version
The text was updated successfully, but these errors were encountered: