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

Fixed interception on a catch-all route #72902

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

Reflex2468
Copy link

@Reflex2468 Reflex2468 commented Nov 17, 2024

For Contributors

Fixing a bug

Fixes #72523
Related to b914ad8
Related to #51787

For Maintainers

  • Fixes catch-all segments in intercepted routes.

What?

The regex replacement, also replaces ... with _. Which causes the check below, which handles catch-all segments, to always return false.

const paramName = capture.replace(/\W+/g, '_');

Why?

Currently when you have an intercepted route with a catch-all segment, it only matches the first segment. As soon as you navigate to /multiple/segments the intercept fails because the rewrite is not capturing this correctly.

How?

The changes introduced in b914ad8 added a replace(/\W+/g, '_') which causes the check below to always fail, since if it started with ... that would at that point be replaced with _.

Todo

  • write tests to verify the return value of rewrites has :path* instead of :path

@ijjk
Copy link
Member

ijjk commented Nov 17, 2024

Allow CI Workflow Run

  • approve CI run for commit: 050a720

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@Reflex2468 Reflex2468 force-pushed the fix/interception-route-catch-all branch from ffab6cb to 050a720 Compare November 17, 2024 16:23
@Reflex2468 Reflex2468 changed the title Fixed interception on a catchAll route Fixed interception on a catch-all route Nov 17, 2024
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.

Intercepting Routes with Dynamic catch all segments
2 participants