forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ppr] Request normalization fixes (vercel#65717)
This resolves an issue where a prefetch react server components (RSC) request incorrectly causes cache poisoning issues during revalidation for applications configured with partial prerendering (PPR). It removes the test which used the header directly, and instead defers to the `handleRSCRequest` method which includes specific environment implementations. This also fixes a bug where the prefetch RSC request for the root page was not normalized.
- Loading branch information
1 parent
20b4f8d
commit 975d953
Showing
4 changed files
with
65 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/next/src/server/future/normalizers/request/prefetch-rsc.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { PrefetchRSCPathnameNormalizer } from './prefetch-rsc' | ||
|
||
describe('PrefetchRSCPathnameNormalizer', () => { | ||
const normalizer = new PrefetchRSCPathnameNormalizer() | ||
|
||
it('should match the prefetch rsc pathname', () => { | ||
expect(normalizer.match('/blog/post.prefetch.rsc')).toBe(true) | ||
}) | ||
|
||
it('should not match the prefetch rsc pathname with a different suffix', () => { | ||
expect(normalizer.match('/blog/post.prefetch.rsc2')).toBe(false) | ||
}) | ||
|
||
it('should normalize the prefetch rsc pathname', () => { | ||
expect(normalizer.normalize('/blog/post.prefetch.rsc')).toBe('/blog/post') | ||
}) | ||
|
||
it('should normalize the prefetch rsc index pathname', () => { | ||
expect(normalizer.normalize('/__index.prefetch.rsc')).toBe('/') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters