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

[Bug]: useMatch does not decode params #11777

Closed
moek opened this issue Jul 5, 2024 · 4 comments · Fixed by #11789
Closed

[Bug]: useMatch does not decode params #11777

moek opened this issue Jul 5, 2024 · 4 comments · Fixed by #11789
Labels
awaiting release This issue have been fixed and will be released soon bug

Comments

@moek
Copy link

moek commented Jul 5, 2024

What version of React Router are you using?

6.23.0

Steps to Reproduce

You can try it here: https://stackblitz.com/edit/github-mfpcog-zdd21p?file=src%2FApp.tsx

Or use this code:

export default function App() {
  return (
    <div>
      <Routes>
        <Route path="/user/:username" element={<Username />}></Route>
      </Routes>
    </div>
  );
}

const Username = () => {
  const params = useParams();
  const match = useMatch('/user/:username');
  return (
    <div>
      hello {params.username} vs {match?.params.username}
    </div>
  );
};

Expected Behavior

I would expect useMatch to decode params the same as useParams does.

If I call this URL /user/bücherwurm of the example above, I would expect the following output:

hello bücherwurm vs bücherwurm

Actual Behavior

It looks like useMatch does no more decode the URL Params.

The example above will output

hello bücherwurm vs b%C3%BCcherwurm

If you use 6.22.0 it works as expected, params are decoded by useMatch

@moek moek added the bug label Jul 5, 2024
@timdorr
Copy link
Member

timdorr commented Jul 6, 2024

@brophdawg11 Is this a regression from #11199?

@brophdawg11
Copy link
Contributor

yeah it looks like it - thanks for the repro!

@brophdawg11 brophdawg11 self-assigned this Jul 10, 2024
@brophdawg11 brophdawg11 linked a pull request Jul 10, 2024 that will close this issue
@brophdawg11 brophdawg11 added the awaiting release This issue have been fixed and will be released soon label Jul 10, 2024
@brophdawg11 brophdawg11 removed their assignment Jul 10, 2024
Copy link
Contributor

🤖 Hello there,

We just published version 6.25.0-pre.0 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Copy link
Contributor

🤖 Hello there,

We just published version 6.25.0 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting release This issue have been fixed and will be released soon bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants