Closed
Description
What version of React Router are you using?
6.21.2
Steps to Reproduce
-
Prepare routing with lazy loaded component at root path:
createBrowserRouter([ { path: "/", lazy: async () => { const { Slash } = await import("./components"); return { Component: () => <Slash />, }; }, }, ]);
-
Open app in browser with additional slash at the end of the URL, ie.
http://localhost:3000//
Expected Behavior
Lazy loaded component is rendered at root URL, even though there are two slashes in the URL.
Actual Behavior
Lazy loaded component is not loading, there is Failed to construct 'URL': Invalid URL
error. When component is rendered with element
, it is being rendered correctly.
I prepared a reproduction example: https://codesandbox.io/p/sandbox/blissful-ritchie-9szrnk