-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Add callsite revalidation optout #14542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: dae1b3d The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
23aff25 to
3ee7f30
Compare
3ee7f30 to
62e3f8f
Compare
a015f8b to
8929118
Compare
8929118 to
9c211ae
Compare
|
General approach is looking good on a quick pass! A few minor comments - I'll do some deeper testing once those are updated |
d879db7 to
67ee043
Compare
|
Updated per your comments. good calls 👍 |
|
This is looking awesome! I made some very minor updates inside the router, and instead of testing locally with an app I just wrote a bunch of tests and they all passed so I think we're good on that front. I prefixed it with |
| let defaultShouldRevalidate: boolean; | ||
| if (typeof callSiteDefaultShouldRevalidate === "boolean") { | ||
| // Use call-site value verbatim if provided | ||
| defaultShouldRevalidate = callSiteDefaultShouldRevalidate; | ||
| } else if (shouldSkipRevalidation) { | ||
| defaultShouldRevalidate = false; | ||
| } else { | ||
| defaultShouldRevalidate = isRevalidationRequired; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only functional change - we also need to apply this to any fetcher.load revalidation checks
|
I just kicked off an experimental release from this branch for some alpha testing: |
|
woohoo! Thanks for carrying it to the finish line @brophdawg11! |
|
Am I missing something or holding it wrong? wat.yafw.balanced.mp4 |
|
ooh good catch @brookslybrand. It's because you're actually exporting a Problem is here @brophdawg11. react-router/packages/react-router/lib/dom/ssr/routes.tsx Lines 607 to 613 in a947b03
The existence of this code and the comment makes me believe it might not be as simple as just deleting though. 🤔 |
|
ah, yeah good catch - this is a bug just in the framework mode/single fetch layer, which is why it's not showing up in our data mode tests. We'll need to get e2e tests in as well that can run through this single fetch logic. I've never liked this particular line of code (yes I wrote it 🙃 ) and the issue boils down to the ability to supply a custom Let me poke and see if we can do this properly in |
|
lol so it looks like we actually already did this correctly when we implemented react-router/packages/react-router/lib/dom/ssr/single-fetch.tsx Lines 387 to 391 in a947b03
I think we just forgot to remove the old way of doing it (the above snippet causing the issue here). On a quick look deleting those lines that hardcode it to true doesn't break any single fetch E2E tests and fixes the issue at hand here. I'll dig in a bit more and if it looks right I'll push the change up here. |
|
#14592 removes the above snippet causing the issue and stabilizes the lower level |
|
I repointed this to |
|
I think this is good to merge, but I just want to give |
This adds callsite revalidation optout as brought up here: #10006
If this new value evaluates to
false, it will set that as thedefaultShouldRevalidatevalue that's sent to theshouldRevalidatefunction.