Flush pending revalidations for forwarded action error responses (#96945)
## Bug When a Server Action skips page rendering, the successful response path attaches pending revalidations to the response’s `waitUntil` promise. Error paths, including `notFound()`, did not. As a result, a forwarded action that called `revalidatePath()` or `revalidateTag()` and then threw could return its error response without executing the pending invalidation. ## Fix Centralize the skipped-render revalidation handling and attach its promise to successful and error responses. Actions that continue into page rendering retain the existing behavior, where revalidations are executed before rendering. ## Test Plan Add a production regression test that invokes an action which calls `revalidatePath()` followed by `notFound()` and verifies: - The fallback route’s page is not rendered. - The cache handler receives the expected path-tag invalidation. - Removing the new `waitUntil` attachment causes the test to fail.
Showing
Please
register
or
sign in
to comment