fetchers from useFetcher
disappear from useFechers
when component unmount
#2462
-
Hello, I have a very specific question about the hooks Background: I use a library to render tables (AgGrid). When a cell is edited the library mount a React component to do the edit. In this component I use In short my question is: Are Two possible solutions I foresee would be:
Looking forward to know your thoughts about that. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That's an expected behavior.
Also, when the instance is removed Remix aborts the request. How does AgGrid knows when to unmount the edit component? If you are doing something like fetcher.submit(data)
unmount() // this tells AgGrid to unmount because you already did the submit Then you should tell AgGrid to unmount once the fetcher.type is done. |
Beta Was this translation helpful? Give feedback.
That's an expected behavior.
useFetcher
creates a new fetcher instance when the component mounts. Then when the component unmount the fetcher instance is removed.useFetchers
gives you access to the list of fetcher instances, but if the useFetcher unmount and the instance is removed it will be removed from the list.Also, when the instance is removed Remix aborts the request.
How does AgGrid knows when to unmount the edit component? If you are doing something like
Then you should tell AgGrid to unmount once the fetcher.type is done.