-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
feat(react-router): server action revalidation opt out via $SKIP_REVALIDATION
field.
#14154
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"react-router": patch | ||
--- | ||
|
||
server action revalidation opt out via $SKIP_REVALIDATION field |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -435,7 +435,12 @@ export interface StaticHandler { | |||||
skipRevalidation?: boolean; | ||||||
dataStrategy?: DataStrategyFunction<unknown>; | ||||||
unstable_generateMiddlewareResponse?: ( | ||||||
query: (r: Request) => Promise<StaticHandlerContext | Response>, | ||||||
query: ( | ||||||
r: Request, | ||||||
args?: { | ||||||
filterMatchesToLoad?: (match: AgnosticDataRouteMatch) => boolean; | ||||||
}, | ||||||
) => Promise<StaticHandlerContext | Response>, | ||||||
) => MaybePromise<Response>; | ||||||
}, | ||||||
): Promise<StaticHandlerContext | Response>; | ||||||
|
@@ -3649,7 +3654,14 @@ export function createStaticHandler( | |||||
}, | ||||||
async () => { | ||||||
let res = await generateMiddlewareResponse( | ||||||
async (revalidationRequest: Request) => { | ||||||
async ( | ||||||
revalidationRequest: Request, | ||||||
opts: { | ||||||
filterMatchesToLoad?: | ||||||
| ((match: AgnosticDataRouteMatch) => boolean) | ||||||
| undefined; | ||||||
} = {}, | ||||||
) => { | ||||||
let result = await queryImpl( | ||||||
revalidationRequest, | ||||||
location, | ||||||
|
@@ -3658,7 +3670,9 @@ export function createStaticHandler( | |||||
dataStrategy || null, | ||||||
skipLoaderErrorBubbling === true, | ||||||
null, | ||||||
filterMatchesToLoad || null, | ||||||
"filterMatchesToLoad" in opts | ||||||
? (opts.filterMatchesToLoad ?? null) | ||||||
: null, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we want to fall back on the original value here if they didn't pass an override?
Suggested change
I should go through and clean up some of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually we need it for the first half of the ternary in case they specified an undefined key - they shouldn't, but the types would allow it. Maybe this is easier?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's different behavior. It should be "if provided, use it (undefined, null, new imp), otherwise use default", we need the key check for that. |
||||||
skipRevalidation === true, | ||||||
); | ||||||
|
||||||
|
Uh oh!
There was an error while loading. Please reload this page.