Closed InfiniteXyy closed 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
.
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.