mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What? Using an interception marker next to a dynamic segment does not behave properly when deployed to Vercel ### Why? The named route regex that gets created is not accounting for the interception marker, which is causing the non-intercepted route to match the intercepted serverless function. ### How? This factors in the interception marker when building the named route regex so that the non-intercepted route regex properly matches when loading the non-intercepted page. Deployment verified here: https://test-intercept-mu.vercel.app/ Closes NEXT-1786 Fixes #54650
24 lines
682 B
TypeScript
24 lines
682 B
TypeScript
import { createNextDescribe } from 'e2e-utils'
|
|
import { check } from 'next-test-utils'
|
|
|
|
createNextDescribe(
|
|
'interception-dynamic-segment',
|
|
{
|
|
files: __dirname,
|
|
},
|
|
({ next }) => {
|
|
it('should work when interception route is paired with a dynamic segment', async () => {
|
|
const browser = await next.browser('/')
|
|
|
|
await browser.elementByCss('[href="/foo/1"]').click()
|
|
await check(() => browser.elementById('modal').text(), /intercepted/)
|
|
await browser.refresh()
|
|
await check(() => browser.elementById('modal').text(), '')
|
|
await check(
|
|
() => browser.elementById('children').text(),
|
|
/not intercepted/
|
|
)
|
|
})
|
|
}
|
|
)
|