-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storybook issue "invariant expected app router to be mounted" #460
Comments
Thanks for the report. This is a gray area of compatibility with Next.js, as the compat layer for the pages router from Unfortunately there's not much advice I can give you here but watch that thread in storybookjs/storybook#24722 for potential solutions. |
Thx @franky47 for the quick response. |
Sounds good. Feel free to ping back here if/when you find a suitable solution. |
Here is the workaround until Storybook fix the issue. import {
AppRouterContext,
type AppRouterInstance,
} from 'next/dist/shared/lib/app-router-context.shared-runtime';
const meta = {
decorators: [
(Story) => (
<AppRouterContext.Provider value={{} as AppRouterInstance}>
<Story />
</AppRouterContext.Provider>
),
],
}; |
@franky47 do you maybe know the answer to this question?storybookjs/storybook#24722 (comment) |
Context
What's your version of
nuqs
?"next-usequerystate": "1.15.2"
Next.js information (obtained by running
next info
):Are you using:
basePath
option in your Next.js configwindowHistorySupport
flag in your Next.js configDescription
When running components that uses
useQueryState
in Storybook this error is shownStorybook version:
"storybook": "7.6.8"
"@storybook/nextjs": "7.6.8"
Docs: https://github.com/storybookjs/storybook/blob/next/code/frameworks/nextjs/README.md#nextjs-navigation
My project uses just pages folder so I don't have
appDirectory
set to true.If I enable it then I get this error
This is logical because we are using useRouter in our components.
From next issue https://nextjs.org/docs/messages/next-router-not-mounted
Reproduction
CodeSandbox Link
The text was updated successfully, but these errors were encountered: