facebook / facebook/docusaurus
Add strict client-side routes - always respect presence or absence of a trailing slash
- Ngôn ngữ chính
- TypeScript
- Star
- 66.2k
- Fork
- 10k
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 52
Mô tả
### Have you read the Contributing Guidelines on issues?
- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#issues).
### Prerequisites
- [X] I'm using the latest version of Docusaurus.
- [X] I have tried the `npm run clear` or `yarn clear` command.
- [X] I have tried `rm -rf node_modules yarn.lock package-lock.json` and re-installing packages.
- [X] I have tried creating a repro with https://new.docusaurus.io.
- [X] I have read the console error message carefully (if applicable).
### Description
When running a site with `trailingSlash: false`, the build creates an html file per page, then when going to that page URL with an added slash (e.g. `site.com/page/`) the server returns a page not found with a 404 code as expected, but the client router is re-rendering the page as if the slash wasn't part of the URL, which in turn causes links to break.
### Reproducible demo
https://stylable.io/docs/guides/migration-v3/
### Steps to reproduce
1. open network to see 404 response (you can sometimes see the 404 flickers)
2. see page is re-rendered with the content as if the slash was not there
3. go to the `Runtime reference` link and click it to see a broken link
4. change the initial url to be without the slash and everything works fine
### Expected behavior
Client should respect 404 page and either keep the 404 as is or redirect the URL to remove the slash
### Actual behavior
Client is "fixing" routing without actually redirecting the URL resulting in broken links and 404 flicker
### Your environment
- Public source code: https://github.com/wixplosives/stylable.io
- Public site URL: https://stylable.io/
- Docusaurus version used: 2.3.1
### Self-service
- [ ] I'd be willing to fix this bug myself.
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.