Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
FrancoRATOVOSON opened this issue Apr 2, 2024 · 1 comment
Closed

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

FrancoRATOVOSON opened this issue Apr 2, 2024 · 1 comment

Comments

@FrancoRATOVOSON
Copy link

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 ?

Link: <P extends Path | To<Path>>({ to, params, ...props }: LinkProps<P, Params>) => {
const path = generatePath(typeof to === 'string' ? to : to.pathname, params || ({} as any))

(1) Link component

close: <P extends Path>(options?: Options<P>) => {
const { at, state, ...opts } = options || {}
navigate(at || location.pathname, { ...opts, state: { ...location.state, ...state, modal: '' } })

(2) modal.close function

@oedotme
Copy link
Owner

oedotme commented Apr 3, 2024

@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!

@oedotme oedotme closed this as completed Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants