-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Cannot read property 'prefetch' of null error on StoryBook #19825
Comments
I am having the same issue. If you go back to next 9.5.5 it works then go back 10.0.x it fails. Having said that it appears to a timing issues when doing yarn install. It started working on one of my projects (with 10.0.3) and when I deleted yarn.lock and re-did yarn install it failed. I spent all afternoon trying to figure this out. |
Duplicate of #16864 |
#16864 refers to jest. The solutions / hacks provided there dont work on storybook. |
indeed the other error is on jest / tests.. not on storybook |
It's the same issue though. |
The proposed solution doesnt work here. Closing this is the same as ignoring it. |
@ybrodsky i have made a comment in the other issue, maybe @timneutkens or someone else will be able to help.. |
I believe #19857 would solve both but I need help to write the integration test. |
<Link href="/" prefetch={!process.env.STORYBOOK}>
<Box as="a" justifyItems="center" display="flex">
....
</Box>
</Link> |
Thanks for the suggestion @gfortaine but the solution presented in this comment is cleaner as it doesn't involved modifying the application code, instead, we just mock the router on the storybook. I can see how checking if the application is running inside of storybook and setting prefetch to false would be great, but that would have to be added to the Router on Next.js and not on all links inside of an application! |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
Cannot read property 'prefetch' of null
error is being displayed on StoryBook when making a storybook of an item with<Link>
after updating to Next 10To reproduce
Create a component with the following content:
Expected behavior
Components should render normally as previously experienced on Next 9.
Currently to work around this issue i'm adding
prefetch={false}
to theLink
objects but that disables the prefetch on the website which is not desirableScreenshots
System information
The text was updated successfully, but these errors were encountered: