1df2686bc9
This removes the `basePath` from the output of `usePathname`. Previously this always resulted in hydration errors, this now strips the `basePath` when it's found/configured. Now when you configure `basePath`, you don't have to factor it into your application logic and can instead rely on the values always returning the pathname without it. Fixes #46562
19 lines
448 B
TypeScript
19 lines
448 B
TypeScript
import { createNextDescribe } from 'e2e-utils'
|
|
|
|
import { basePath } from './next.config'
|
|
|
|
createNextDescribe(
|
|
'base path support for usePathname',
|
|
{
|
|
files: __dirname,
|
|
},
|
|
({ next }) => {
|
|
it.each(['/', '/dashboard'])(
|
|
'should render %s without the basePath',
|
|
async (pathname) => {
|
|
const $ = await next.render$(basePath + pathname)
|
|
expect($('#pathname').data('pathname')).toBe(pathname)
|
|
}
|
|
)
|
|
}
|
|
)
|