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
47 stars 11 forks source link

feat: support router-state in story paramters #3

Closed InfiniteXyy closed 2 years ago

InfiniteXyy commented 2 years ago

https://github.com/JesusTheHun/storybook-addon-react-router-v6/issues/2

This is a simple solution for specifying the router state. I think it works pretty fine in my usecase. But I'm not sure if it has any limitations.

JesusTheHun commented 2 years ago

Hey! Thank you for your contribution !

I have reviewed your PR but unfortunately if you create a component that update the state itself, you will see that the location state define in the story definition always overwrite the state, including after the component itself defines a new state. So I decided to fix this, but after many iterations I realized that your approach of wrapping the story and manually setting the location.state many more issues with the panel not registering the correct state, or creating more entries than required.

In the end I decided to implement this feature with my own approach, injecting the state in the memory route as the initial entry.

You can now update your package to version 0.1.11.