JesusTheHun / storybook-addon-remix-react-router

Use your app router in your stories. A decorator made for Remix React Router and Storybook
Apache License 2.0
45 stars 11 forks source link

Support my laziness #35

Closed jpink closed 10 months ago

jpink commented 1 year ago

Please support lazy property in router parameters.

That way I can easily test my loader, action, Component, ErrorBoundary parts which are exported (using those names) in my FooPage.jsx file. The testing of actual lazy loading isn't the point. The point is to allow easier and shorter story definition and ensures that parts are exported correctly.

So that way the ultimate minimal story definition would be:

import { withRouter } from 'storybook-addon-react-router-v6'

export default {
  title: 'FooPage',
  decorators: [withRouter],
  parameters: {
    reactRouter: {
      lazy: () => import('./FooPage') // the page exports Component and usually loader, ...
    }
  }
}

export const Foo = {}
JesusTheHun commented 12 months ago

FYI I'm working on a v2 that will -among other things- give birth to this feature.

JesusTheHun commented 11 months ago

This is now natively supported in v2 : https://github.com/JesusTheHun/storybook-addon-react-router-v6/releases/tag/v2.0.0-rc.0. Can you give it a try and tell me if it's ok for you ?

JesusTheHun commented 10 months ago

@jpink I'm closing this as completed. Feel free to re-open if you face any issue.