oedotme / generouted

Generated file-based routes for Vite
https://stackblitz.com/github.com/oedotme/generouted/tree/main/explorer
MIT License
1.02k stars 47 forks source link

Modals.close at doesn't redirect when with params #160

Closed FrancoRATOVOSON closed 5 months ago

FrancoRATOVOSON commented 5 months ago

My code looks like this :

modals.close({
  at: '/:income',
  params: {
    income: selectedIncome
  }
})

And it redirect me littrealy to /:income but dont replace the ":income" with selectedIncome. I had to replace it with useNavigate and it worked. I looked in the codebase and I wonder if the miss of generatePath in the code of modal.close (2) like in Link (1) component could be the origin ?

https://github.com/oedotme/generouted/blob/0cadbbfef348fe82cdd1baaf71abd3d654c1a0a7/packages/react-router/src/client/components.tsx#L7-L8 (1) Link component

https://github.com/oedotme/generouted/blob/0cadbbfef348fe82cdd1baaf71abd3d654c1a0a7/packages/react-router/src/client/hooks.ts#L34-L36 (2) modal.close function

oedotme commented 5 months ago

@FrancoRATOVOSON Thanks for reporting this. This was indeed an issue related to both modals open and close methods, which the at params weren't resolving at all.

It should be fixed now at v1.18.6, Thanks!