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

Fix optional parameter matching #10917

Closed
wants to merge 1 commit into from
Closed

Fix optional parameter matching #10917

wants to merge 1 commit into from

Conversation

neemzy
Copy link

@neemzy neemzy commented Oct 6, 2023

If I understood correctly, optional parameter (e.g. /foo/:bar?) support was initially dropped in v6 before being reintroduced. However, upon trying to migrate an app from v5 to v6, I realized matchPath returns null when trying to match a path against a pattern containing optional parameters, even though it should match.

This PR fixes this, but in a probably hazardous way. This allows me to keep working on said migration while, hopefully, I can discuss this problem with you (and eventually implement a better solution for it).

Thanks!

@changeset-bot
Copy link

changeset-bot bot commented Oct 6, 2023

🦋 Changeset detected

Latest commit: cb83034

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@remix-run/router Patch
react-router Patch
react-router-dom Patch
react-router-dom-v5-compat Patch
react-router-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Oct 6, 2023

Hi @neemzy,

Welcome, and thank you for contributing to React Router!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run.

Thanks!

- The Remix team

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Oct 6, 2023

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@timdorr
Copy link
Member

timdorr commented Oct 7, 2023

Related: #9862

@brophdawg11
Copy link
Contributor

yeah I think this is a dup of #10768. I'll try to look over them soon and see if we can get one of them merged.

@brophdawg11 brophdawg11 self-assigned this Oct 13, 2023
@neemzy
Copy link
Author

neemzy commented Oct 16, 2023

@brophdawg11 FWIW that other PR you mentioned #10768 looks much better than whatever I hastily hacked together, if you want to reduce noise feel free to close this one and I'll follow that one.

@brophdawg11
Copy link
Contributor

ok thanks!

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants