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
Since I'm only using 'app' directory routing, I set nextjs: { appDirectory: true, },.
preview.tsx
import{helloHandler}from"../mocks/api/hello";importtype{Preview}from"@storybook/react";import{initialize,mswLoader}from"msw-storybook-addon";import"../app/globals.css";import"./preview.css";importReactfrom"react";importwithAppRouterContextfrom"./withAppRouterContext";initialize();constpreview: Preview={decorators: [],parameters: {controls: {matchers: {color: /(background|color)$/i,date: /Date$/i,},},msw: {handlers: {hello: [...helloHandler],},},nextjs: {appDirectory: true,},},// Provide the MSW addon loader globallyloaders: [mswLoader],};exportdefaultpreview;
In my Header.stories.tsx, I set the pathname and asPath.
Header.stories.tsx
importtype{Meta,StoryObj}from"@storybook/react";import{Header}from"@/src/widgets/header";constmeta={title: "Widgets/Header",component: Header,tags: ["autodocs"],parameters: {nextjs: {router: {pathname: "/booth",asPath: "/booth",},},},}satisfiesMeta<typeofHeader>;exportdefaultmeta;typeStory=StoryObj<typeofmeta>;exportconstDefault: Story={};exportconstNavigatable: Story={};// TODO write tests for different pathnames and different history stack
I attempted to check the pathname in Header.tsx, but it's fixed to /.
Describe the bug
I followed the next.js guideline in the official docs.
nextjs: { appDirectory: true, },
.preview.tsx
pathname
andasPath
.Header.stories.tsx
pathname
inHeader.tsx
, but it's fixed to/
.Header.tsx
directory structure
To Reproduce
https://github.com/algoORgoal/repo-router-not-working/tree/feature/booth-create
System
Additional context
No response
The text was updated successfully, but these errors were encountered: