-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Content of statically generated index page shows up on every dynamic routes #12905
Comments
Any response? Please help me. I think this is a bug or something should be documented but actually not. |
We just merged some fixes to the interop between Specifically, when the app doens't prerender We now generate a valid "SPA Fallback" file in You probably want to change your nginx config to something like:
|
This resolves my issue perfectly. Big thanks to you! |
Discussed in #12891
Originally posted by batchor January 29, 2025
My situation is a little bit complicated and I will try my best to tell a clear story.
Simple description
The content of the statically generated index page is showing up on every dynamic client-side rendered route.
Please visit https://debug.batchfy.com and https://debug.batchfy.com/a/b to checkout the behaviours.
Detailed story
I have a dynamic route, e.g., '/:user/:project', and all other pages, including the index page, are statically generated during building for SEO purposes.
My
react-router.config.ts
:and my
app/routes.ts
:In my
app/routes/home.tsx
, I simply have:And my
app/routes/project.tsx
displays the route parameters:The
nginx.conf
:Expected behavior
When I visit
example.com
, I can see "Homepage" on the screen.And when I visit
example.com/user1/project2
, I see "user1/project2".Actually behavior:
When I visit
example.com/user1/project1
, the actual result is:"
Homepage
user1/project1
"
The content of the statically generated index page, "Homepage", shows up on every dynamical route.
Other information
npm run dev
works perfectly fine; the issue arises only with the static build when deployed behind Nginx.Source code
https://github.com/batchor/react-router
The text was updated successfully, but these errors were encountered: