Why when a useFetcher unmounts the route is re-rendered? #11303
Replies: 2 comments 1 reply
-
I have a feeling it has to do with RR maintaining a list of active fetchers (for If you add Whether this is desired, I don't know. I typically don't worry about re-renders like this. You generally want your app to re-render to stay in sync with data. |
Beta Was this translation helpful? Give feedback.
-
@juandiegombr Did you solve this problem ? |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
After some debug work with a non expected behavior using
react-router-dom
I have arrived to this fact that I am not sure wether is desirable or a bug.I have prepared this little demo to show you the behavior: DEMO
Project structure:
main.tsx
file.Root
route usinguseLoaderData
(<Root />
)useFetcher
(<ComponentWithFetcher/>
)<FetcherToggle />
)To reproduce the behavior:
Toggle the component with fetcher
useFetcher
What happens?
unmounted
. You can see the counter of renders is incremented.What do I expected?
Root
route is not re-rendered.Additional questions:
Beta Was this translation helpful? Give feedback.
All reactions