Replies: 4 comments 1 reply
-
I guess one of the approaches would be the unstable_shouldReload function also discussed here. |
Beta Was this translation helpful? Give feedback.
-
How are you navigating to the Remix should not call parent loaders when navigating to a route with common ancestors. The only time the loaders will be fetched again is after a post, like when you actually submit the new record, since you actually want the records list to be refetched. |
Beta Was this translation helpful? Give feedback.
-
I am using navigate from useNavigate
… On 8 Apr 2022, at 18:49, Kiliman ***@***.***> wrote:
How are you navigating to the /records/create route? Are you using the <Link/> component?
Remix should not call parent loaders when navigating to a route with common ancestors.
The only time the loaders will be fetched again is after a post, like when you actually submit the new record, since you actually want the records list to be refetched.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
I was expecting the same behavior, but that is not the case. I did a little more experimenting and I figure out that it was due to changed URL searchParams. Here is a case with a Delete dialog that takes The initial address is: Then you select the checkboxes next to a couple of rows in the table and click bulk Delete. The new address is: This triggers a reload on the /records route as well. I guess this should be the expected behavior. Thanks for the help! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following setup:
records.tsx (BLUE)
Parent route with a loader that loads data and renders a table and a Create button that open
/routes/create
records/create.tsx (RED)
Nested route that opens a modal dialog with form and an action handler.
Scenario
Is there a way to prevent calling the records.tsx loader and re-render when opening /create route?
The only solution I have is to delete the create.tsx route and make a create dialog component that is a rendered together with records.tsx, but only visible if the url has /create at the end of the pathname, which defeats the purpose of react router nested routes imo.
Beta Was this translation helpful? Give feedback.
All reactions