react-router icon indicating copy to clipboard operation
react-router copied to clipboard

🗺 Optional Route Segments

Open ryanflorence opened this issue 3 years ago • 2 comments

Allow route paths to include optional segments like /foo/:bar?.

Progress

  • [x] RFC - https://github.com/remix-run/react-router/discussions/9550
  • [x] Router PR - #9650
  • [x] Router PR (fixes #9650) https://github.com/remix-run/react-router/pull/9684
  • [x] Remix PR - https://github.com/remix-run/remix/pull/4706
  • [x] Changeset - https://github.com/remix-run/remix/pull/4815

Issues/PRs

#7285 #9208 #8381 #8566

Docs

  • [ ] Update docs
  • [ ] Update migration guides that mention manual writing out the routes
    • one in the docs
    • also this discussion #8753
    • Go into both and just use optional segments instead of talking about v6 not supporting them anymore

ryanflorence avatar Nov 02 '22 21:11 ryanflorence

I've been working through some fixes to https://github.com/remix-run/react-router/pull/9650 to account for nested <Route>s. @brophdawg11 and I have been coordinating and the decision is to add some tests for nested <Route>s and to explode each relative path (with 1+ optional path segment) encountered in flattenRoutes.

PR: https://github.com/remix-run/react-router/pull/9684

pcattori avatar Dec 06 '22 00:12 pcattori

~~Just waiting for Remix to be on RR 6.5 before merging the last PR (#4706) and closing out this roadmap item.~~

All code PRs have been merged. We just need to wait for Remix to be on RR 6.5 to update the docs.

pcattori avatar Dec 09 '22 16:12 pcattori

awesome! we'll leave this issue open until we're on router 6.5 :)

ryanflorence avatar Dec 09 '22 22:12 ryanflorence

All of this is going out in the next Remix/Router releases.

ryanflorence avatar Dec 13 '22 19:12 ryanflorence

This is available for beta testing in Remix 1.9.0-pre.0 and React Router 6.5.0-pre.1 if anyone wants to give it a test! We're hoping to get the stable releases out later today or tomorrow.

brophdawg11 avatar Dec 15 '22 18:12 brophdawg11