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

[SingleFetch][basename] root data endpoint is outside basename #10212

Open
freeman opened this issue Nov 11, 2024 · 1 comment
Open

[SingleFetch][basename] root data endpoint is outside basename #10212

freeman opened this issue Nov 11, 2024 · 1 comment

Comments

@freeman
Copy link
Contributor

freeman commented Nov 11, 2024

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

System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (2) x64 AMD EPYC
    Memory: 919.50 MB / 4.01 GB
    Container: Yes
    Shell: Unknown
  Binaries:
    Node: 20.9.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.8.1 - /usr/local/bin/npm
    pnpm: 8.10.2 - /usr/local/share/npm-global/bin/pnpm
  npmPackages:
    @remix-run/css-bundle: ^2.14.0 => 2.14.0 
    @remix-run/dev: ^2.14.0 => 2.14.0 
    @remix-run/node: ^2.14.0 => 2.14.0 
    @remix-run/react: ^2.14.0 => 2.14.0 
    vite: ^5.4.11 => 5.4.11 

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.

@freeman freeman changed the title [SingleFetch][basename] root data endpoint is outside base name [SingleFetch][basename] root data endpoint is outside basename Nov 11, 2024
@freeman
Copy link
Contributor Author

freeman commented Nov 11, 2024

I think this impact React Router v7 as well though I have not verified it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant