How to fetch a loader under a path which include dynamic segments? #11829
CurryYangxx
started this conversation in
General
Replies: 1 comment 1 reply
-
If your effect doesn't have parentId as a dependency it won't run again when that change, aside of that your condition will also prevent the fetcher.load to run again because it already has data. Instead of using a fetcher I recommend you to load the data in the route loader itself, not move it to another route and fetch with a fetcher client-side. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have router like this.
In ParentComponent, I want to fetch some data whenever parentId changes. The first approach I tried was like this, but the loader didn't revalidate when the parentId changed.
Then I pass a key into useFetcher. But every parentId loader only fetch once. I look into
useFetcher
source code here, we delete the fetcher after fetcherKey change, but we didn't delete data from fetcherData inrouter.deleteFetcher
.So my questions are:
Beta Was this translation helpful? Give feedback.
All reactions