Code Monkey home page Code Monkey logo

Comments (7)

dimaMachina avatar dimaMachina commented on July 24, 2024 5

@nirtamir2 seems like this addon doesn't pass down experimental options, found a workaround to work with newNextLinkBehavior 💪

in your preview.tsx file add the following

import NextLink, { LinkProps } from 'next/link';

const OriginalNextLink = NextLink;

Object.defineProperty(NextLink, 'default', {
  configurable: true,
  value: (props: LinkProps) => <OriginalNextLink {...props} legacyBehavior={false} />,
});

from storybook-addon-next.

gregorybolkenstijn avatar gregorybolkenstijn commented on July 24, 2024 2

@B2o5T Thanks, that fixed it for me!

from storybook-addon-next.

nirtamir2 avatar nirtamir2 commented on July 24, 2024 1

@B2o5T Thanks! It works for me too 👍

from storybook-addon-next.

RyanClementsHax avatar RyanClementsHax commented on July 24, 2024

Thanks for opening this issue!

The addon doesn't resolve that config as of right now. Resolving next config is difficult because nextjs does a lot of transformations internally to the config that then gets fed to its components. In order to provide a stable api, I have opened a ticket with nextjs to make this easier.

See this discussion for more details #119

from storybook-addon-next.

zaratan avatar zaratan commented on July 24, 2024

This will also fix issues with the new next/link used by default in Next13. This should maybe be part of #124 for it to be "valid".

from storybook-addon-next.

nix6839 avatar nix6839 commented on July 24, 2024

@nirtamir2 seems like this addon doesn't pass down experimental options, found a workaround to work with newNextLinkBehavior 💪

in your preview.tsx file add the following

import NextLink, { LinkProps } from 'next/link';

const OriginalNextLink = NextLink;

Object.defineProperty(NextLink, 'default', {
  configurable: true,
  value: (props: LinkProps) => <OriginalNextLink {...props} legacyBehavior={false} />,
});

More simple solution:

// preview.ts
process.env.__NEXT_NEW_LINK_BEHAVIOR = 'true'

from storybook-addon-next.

RyanClementsHax avatar RyanClementsHax commented on July 24, 2024

Since next 13 support has been released, I'm closing this issue

from storybook-addon-next.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.