Skip to content
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

[Documentation]: Next.js integration page needs to be updated for new next/image handling #23561

Open
Atralbus opened this issue Jul 21, 2023 · 7 comments
Assignees

Comments

@Atralbus
Copy link

Atralbus commented Jul 21, 2023

Describe the problem

Starting from Next.js 13.4.8, it was not possible to redefine the Image component. This issue is fixed with #23296. In Next.js documentation page there is a codeblock to unoptimize the Image component which still depends on redefining the component;

// .storybook/preview.js
import * as NextImage from "next/image";

const OriginalNextImage = NextImage.default;

Object.defineProperty(NextImage, "default", {
  configurable: true,
  value: (props) => <OriginalNextImage {...props} unoptimized />,
});

Additional context

No response

@jonniebigodes
Copy link
Contributor

@Atralbus, thanks for reaching out to us and letting us know of that issue. So that you know that the blog post you're referring to is quite outdated, more even as Storybook now has a Next.js framework integration. Also, so that you're aware, the most accurate documentation is located in the integration's README. At some point, we're going to update the documentation accordingly and feature the information provided.

Let us know if you spot any issues in the documentation I mentioned so that we can adjust it accordingly.

Hope you have a fantastic weekend.

Stay safe

@valentinpalkovic
Copy link
Contributor

valentinpalkovic commented Jul 22, 2023

@jonniebigodes: @Atralbus has a point! These blog articles are listed on search engine searches pretty high! We have to either remove them or update them as soon as possible to add a preface, which links to newer documentation. We have this problem with lots of blog articles, which confuses users

@Atralbus
Copy link
Author

Atralbus commented Jul 22, 2023

@jonniebigodes My bad. I probably used that documentation before switching to @storybook/nextjs and that configuration was absolute. But @valentinpalkovic is right, when I was first integrating storybook to a nextjs project, those were probably the first results that came up on google.

@jonniebigodes
Copy link
Contributor

@Atralbus, no worries, and I'm glad that you surfaced this. And to your point @valentinpalkovic we can start by vetting the articles and prefacing them with the updated documentation location. Sounds good?

@valentinpalkovic
Copy link
Contributor

valentinpalkovic commented Jul 22, 2023

@jonniebigodes sounds perfect. Let me know if you need any support

@jonniebigodes
Copy link
Contributor

Will do @valentinpalkovic, will do 🙏

@Tanosimboangy
Copy link

Tanosimboangy commented Dec 6, 2023

This is solved by removing the strict mode:
Instead of:

import * as NextImage from "next/image"

Do it this way:

import NextImage from "next/image";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

5 participants