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

fix: no need to use generatePath in generateAppUrl #4

Closed peetck closed 2 years ago

peetck commented 2 years ago

in case like param value have : like this it will error in generateAppUrl().

reactRouter: {
      routePath: "/:someParam",
      routeParams: { someParam: ":someValue" },
},

because our location.pathname will become /:someValue and in useCreateEventData() we pass it to generateAppUrl() that will call generatePath() like this.

generatePath('/:someValue', { someParam: ':someValue' })
Screen Shot 2565-08-02 at 01 00 56

to fix it i think we just need pathname from location.pathname in generateAppUrl().

sorry for my bad english 😄 .

JesusTheHun commented 2 years ago

Hi! Thanks you for your contribution.

I was able to reproduce the issue locally. The issue however doesn't lie in the generateAppUrl function itself but in the fact that the function is used here. So I submitted a fix in addition to some additional stories to test the behaviour.