Skip to content

Remove unnecessary hasShouldRevalidate condition for opting out#15012

Merged
brophdawg11 merged 4 commits into
remix-run:devfrom
dadamssg:fix-revalidation-optout
May 4, 2026
Merged

Remove unnecessary hasShouldRevalidate condition for opting out#15012
brophdawg11 merged 4 commits into
remix-run:devfrom
dadamssg:fix-revalidation-optout

Conversation

@dadamssg

@dadamssg dadamssg commented May 2, 2026

Copy link
Copy Markdown
Contributor

This fixes a bug when unstable_defaultShouldRevalidate={false} is used and a matched route does not export a shouldRevalidate function. The current code skips counting the route as a route to opt out when determining when to set the _routes query param.

I wrote a test with 3 routes, all with their own loaders and no shouldRevalidate functions.

app/root.tsx
app/parent.tsx
app/parent.a.tsx

When on the /parent route, i'm clicking a link with unstable_defaultShouldRevalidate={false} to navigate to /parent/a. This should trigger a data call for only app/parent.a.tsx's loader. However, the data call that's executed does not have the _routes query param, so all loaders are revalidated.

This PR makes it so that the data call is only to fetch app/parent.a.tsx's loader data.

@dadamssg dadamssg force-pushed the fix-revalidation-optout branch 2 times, most recently from aeb65ce to b0bc444 Compare May 2, 2026 03:47
@dadamssg dadamssg force-pushed the fix-revalidation-optout branch from b0bc444 to 49cbdd2 Compare May 2, 2026 03:47
@brophdawg11 brophdawg11 self-assigned this May 3, 2026
@brophdawg11

Copy link
Copy Markdown
Contributor

Nice catch! Thanks for the fix 👍

@brophdawg11 brophdawg11 merged commit 67518cb into remix-run:dev May 4, 2026
9 of 11 checks passed
@ryanflorence ryanflorence mentioned this pull request May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants