fix(website): generate rule docs in config hook to fix rule page 404s#557
fix(website): generate rule docs in config hook to fix rule page 404s#557
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical navigation issue on the website where internal rule links were causing 404 errors due to incorrect routing. By adopting Rspress's client-side navigation hook, the site now handles internal links consistently with its SPA architecture, ensuring a smoother user experience and preventing broken links. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses a navigation issue on the website where internal rule links were causing 404 errors. The fix involves replacing direct browser navigation (window.location.href) with client-side routing using the useNavigate hook from Rspress. This change correctly aligns the component's behavior with that of a single-page application, preventing unnecessary page reloads and resolving the 404 errors. The implementation is sound and follows standard practices for SPAs.
Deploying rslint with
|
| Latest commit: |
51ee44c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://89ae9dfb.rslint.pages.dev |
| Branch Preview URL: | https://fix-website-rule-nav-404-202.rslint.pages.dev |
The pluginRuleManifest wrote rule .mdx files during beforeBuild, but Rspress 2.0 discovers routes before that hook runs. On Cloudflare Pages (fresh clone) no generated files existed at route discovery time, causing all rule pages to 404. Move file generation to the config hook which executes before route discovery.
51ee44c to
6d94243
Compare
Summary
All rule pages returned 404 on the deployed website while working fine locally.
Root cause:
pluginRuleManifestgenerated rule.mdxfiles in thebeforeBuildhook, but Rspress 2.0 discovers routes before that hook runs. Locally this was masked because generated files persisted from previous builds (gitignored but not deleted). On a fresh clone, no rule docs existed at route discovery time — confirmed by the build output showing only 7 pages in the sitemap with zero rule-specific pages.Fix: move file generation from
beforeBuildto theconfighook, which executes before route discovery.Related Links
N/A
Checklist