Skip to content

useMatchRoute not updating when using React Compiler #4499

Open
@vixducis

Description

@vixducis

Which project does this relate to?

Router

Describe the bug

When using the function returned by useMatchRoute in combination with React Compiler, it looks the result is only evaluated on the initial render.

When using the repro stackblitz, you can remove the react compiler config, which will make the repro case act as I would expect it to.

Your Example Website or App

https://stackblitz.com/edit/github-jbydd83d?file=src%2Fmain.tsx

Steps to Reproduce the Bug or Issue

Using the reproduction scenario:

  1. Click on the "To About"-link
  2. The "Matched route name" doesn't change
  3. Refresh
  4. The "Matched route name" updates to the correct label

Expected behavior

The "Matched route name" label changes on each navigation change.

Screenshots or Videos

No response

Platform

  • OS: Linux
  • Browser: Chromium
  • Version: 137

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions