You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stories that include components which use the hooks useSelectedLayoutSegment() and useSelectedLayoutSegments() from next/navigation produce the following error:
Describe the bug
Stories that include components which use the hooks
useSelectedLayoutSegment()
anduseSelectedLayoutSegments()
fromnext/navigation
produce the following error:This error appears for all stories and not just the one using the hook.
To Reproduce
Here is a reproduction repo.
Create a Next.js 13 project:
Add Storybook:
I skipped both migrations (eslintPlugin and mdx1to2), I don't believe they are relevant to this bug.
Add the following lines to the beginning of any component under the
stories
directory:The 'use client' directive must be applied to use the hook.
Inside the same component, use the hook like so:
Run Storybook:
None of the stories are rendered, all produce the following error:
Full error details can be seen above
The error still occurs after adding
nextjs
parameters to each of the Button stories:And also after passing a pathname to
navigation
innextjs
:System
Additional context
No response
The text was updated successfully, but these errors were encountered: