-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
404 page not rendered when routeBasePath
is "/"
, and no version uses that path
#9688
Comments
Related to of #9688 Not really a duplicate. However the problem/solution is likely to be the same: make react-router-config render top-level 404 if no subroute matches current path |
That issue number is this issue. Did you mean to link to something else? |
Also, any suggestions on a workaround? |
Sorry 🤪 #9665 I think a workaround could be to create a 404.md doc with slug |
I'd love to help pitch in if possible! Feel free to thoughtdump how someone would go about doing this 😄 |
There's some bits of code that seem to have the intention of showing the
|
@huonw You have found out how we show 404 "in general". However, the docs plugin is weirder: it declares a wildcard subpath match (like |
Ah, right, okay, so with |
Yes, exactly :D |
Curious, why is the not found working on our own website? 🤔 There are a few ways we could handle it.
Currently we render routes with a package:
Problem: if a parent route match the path, but no child route match the path, then it does not "escape" the parent route and try to enter another parent route that also matches, nor does it try to render the default This is IMHO what we should fix. This would also enable us to have 2 plugins use
This can be interesting because some users might have a dedicated 404 That's probably overkill (and requires CDN config to route Not a priority IMHO I would go with solution 2, but that's probably not easy. Note this code doesn't even exist anymore in React-Router v6 (and we'll probably want to upgrade later so need to make sure our solution will be compatible) |
I wonder if we're ought to try and see if this bug exists after upgrading. You might be able to feed two birds with one scone. And if not, we likely ought to file an issue so it's made known to the maintainer(s) |
Okie dokie, I know it wasn't your first choice, but decided to take a stab at the "easy" solution here of 1. I'm relatively noviced when it comes to JS (and furthermore TS), so feel free to tear me a new one with suggestions/questions/etc... I try and learn through osmosis. |
@slorber there is a workaround, although it's not for the faint of heart 😆 |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
Combining
routeBasePath: '/',
with having each version at a specific path (the version itself) results in unknown pages rendering "blank" content (instead of the "Page not found" content).Reproducible demo
https://stackblitz.com/edit/github-py3g6d?file=docusaurus.config.js
Steps to reproduce
From a fresh project:
$ npm run docusaurus docs:version 1.1.0
And add the following to the
docs
config:then visit
/foo
route. No "Page Not Found" content 😢Expected behavior
Render the "Page not found" content
Actual behavior
Empty page
Your environment
No response
Self-service
The text was updated successfully, but these errors were encountered: