Open freeman opened 2 weeks ago
I think this impact React Router v7 as well though I have not verified it there.
We encounter the same problem when trying to enable single fetch in our application with basename in the config.
On the first render the root route renders perfectly and we can navigate to other routes in the application and everything seems to work fine. Whenever we click a link which points to root it fails.
<NavLink to={"/"}>
Root path
</NavLink>
Unable to decode turbo-stream response from URL: http://localhost:3000/foo.data
Someone posted the same issue on RR and kindly provided a patch for remix that works great in my tests: https://github.com/remix-run/react-router/issues/12295
Reproduction
You can see the issue on this code sandbox: https://codesandbox.io/p/devbox/zwd9rl
If you hit the "Increment" button you will get an error that is due to vite rejecting the request to /foo.data as it is outside the vite base (== remix basename) which is "/foo/".
I think this was introduced involuntarily by #9792 as it tries to prevent the
/.data
url format.System Info
Used Package Manager
pnpm
Expected Behavior
I would expect requests for the root/_index data loader when a basename (
/foo/
for example) is present to honor it and use either :/foo/_root.data
/foo/.data
(though I agree that this format is not great as it may often be blocked as an attempt to access hidden files)Actual Behavior
When a basename is configured root/index loader data url goes outside of the basename.