Commit 92d2cc1f authored by Zack Tanner's avatar Zack Tanner

failing repro for parallel route fallback shells

parent 5b4cdc3d
'use client'
import { usePathname } from 'next/navigation'
import React from 'react'
const MyContext = React.createContext('default value')
export function ContextProvider({ children }: { children: React.ReactNode }) {
const pathname = usePathname()
return <MyContext.Provider value={pathname}>{children}</MyContext.Provider>
}
export default function Page() {
return <div>slot catchall</div>
}
'use client'
import { usePathname } from 'next/navigation'
import React from 'react'
const MyContext = React.createContext('default value')
export function ContextProvider({ children }: { children: React.ReactNode }) {
const pathname = usePathname()
return <MyContext.Provider value={pathname}>{children}</MyContext.Provider>
}
export default function Page() {
return <div>foo</div>
}
import React from 'react'
import { ContextProvider } from './context'
export default function Root({
children,
slot,
}: {
children: React.ReactNode
slot: React.ReactNode
}) {
return (
<html>
<body>
<ContextProvider>
<div id="children">{children}</div>
<div id="slot">{slot}</div>
</ContextProvider>
</body>
</html>
)
}
import Link from 'next/link'
export default async function Home() {
return (
<div>
<div>
<Link href="/foo">Go to /foo</Link>
</div>
</div>
)
}
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: {
cacheComponents: true,
},
}
module.exports = nextConfig
import { nextTestSetup } from 'e2e-utils'
describe('parallel-routes-catchall-fallback-shell', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should not include catchall route in build output', async () => {
expect(next.cliOutput).not.toContain('/[...catchAll]')
})
it('should work', async () => {
const browser = await next.browser('/')
await browser.elementByCss('[href="/foo"]').click()
expect(await browser.elementById('slot').text()).toBe('slot catchall')
expect(await browser.elementById('children').text()).toBe('foo')
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment