Skip to content

[Bug]: Navigation from '//' pathname does not work; path '*' is not matching the '//' page #11429

@MateuszGroth

Description

@MateuszGroth

What version of React Router are you using?

6.22.3

Steps to Reproduce

Case 1 - Create a router to test * path

<Route
    path="/"
    element={<Outlet />}
  >
     <Route path="*" element={<>Test * Path</>} />
</Route>

Case 2 - Create a router to test 'navigate'

const TestNavigate = () => {
  const navigate = useNavigate();

  useEffect(() => {
    navigate("/test");
  }, [navigate]);

  return <Outlet />;
};

<Route path="/" element={<TestNavigate />}>
    <Route path="*" element={<>Test</>} />
</Route>

Enter the app with '//' path on either case

Expected Behavior

Case 1 - Test * Path should be rendered
Case 2 - navigate should work

Actual Behavior

Case 1 - nothing is rendered
Case 2 - navigate doesn't work with the following error:
TypeError: Failed to construct 'URL': Invalid URL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions