-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Open
Description
Describe the bug
Support for Catch-All segments was undocumented and worked this way:
{
nextjs: {
appDirectory: true,
navigation: {
segments: [
['catch-all', 'as/many/as/you/want', 'c']
]
}
}
}The trailing c marked it as "catch-all".
This was removed on storybook v10, now it expects this:
{
nextjs: {
appDirectory: true,
navigation: {
segments: [
['catch-all', ['as', 'many', 'as', 'you', 'want']]
]
}
}
}This works fine for useParams, but errors with useSelectedLayoutSegment. It errors with:
The only workaround I found is the following, but I think it's about time to properly document this functionality and fix it if you ask me.
export function makeMockSegment(path: string[]): string[] {
Object.defineProperty(path, "startsWith", {
value: () => {
return false;
},
});
return path;
}
[...]
nextjs: {
appDirectory: true,
navigation: {
segments: [
['catch-all', makeMockSegment(['as', 'many', 'as', 'you', 'want'])]
]
}
}Reproduction link
https://stackblitz.com/edit/github-vm266l82?file=src%2Fstories%2FPage.tsx
Reproduction steps
No response
System
System:
OS: macOS 26.0
CPU: (10) arm64 Apple M1 Max
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.9.0 - ~/.local/share/mise/installs/node/24.9.0/bin/node
Yarn: 4.6.0 - ~/.local/share/mise/installs/yarn/4.6.0/bin/yarn <----- active
npm: 11.6.0 - ~/.local/share/mise/installs/node/24.9.0/bin/npm
Browsers:
Chrome: 142.0.7444.60
Safari: 26.0
npmPackages:
@storybook/addon-links: 10.0.5 => 10.0.5
@storybook/nextjs: 10.0.5 => 10.0.5Additional context
No response
dosubot