chore: add React Start basic Rsbuild example#7729
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR adds a new Changesstart-basic-rsbuild example app
Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (2)
examples/react/start-basic-rsbuild/src/routes/api/users.ts (1)
30-35: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove commented-out dead code.
This commented-out block isn't wired to anything and adds noise to an otherwise clean example.
♻️ Proposed cleanup
- - // if (Math.random() > 0.5) { - // throw new Response(null, { - // status: 302, - // headers: { Location: 'https://www.google.com' }, - // }) - // } -🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@examples/react/start-basic-rsbuild/src/routes/api/users.ts` around lines 30 - 35, The commented-out dead code in the users route should be removed to keep the example clean. Delete the unused conditional redirect block from the api users handler in the relevant route module, and ensure the remaining route logic in the same file stays unchanged and readable.examples/react/start-basic-rsbuild/src/components/NotFound.tsx (1)
3-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid
anyforchildrenprop.
children?: anyweakens type safety;React.ReactNodeis the correct type here and is already used the same way in__root.tsx'sRootDocument.As per coding guidelines,
**/*.{ts,tsx}: "Use TypeScript strict mode with extensive type safety."♻️ Proposed fix
-export function NotFound({ children }: { children?: any }) { +export function NotFound({ children }: { children?: React.ReactNode }) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@examples/react/start-basic-rsbuild/src/components/NotFound.tsx` at line 3, The NotFound component’s children prop is typed too loosely with any, which breaks TypeScript safety. Update the NotFound function signature to use React.ReactNode for children, matching the typing used in RootDocument in __root.tsx, and keep the prop optional if needed.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@examples/react/start-basic-rsbuild/.gitignore`:
- Line 13: The ignore entry is malformed because the Sentry note is attached to
the same line as the /public/build pattern, so the path is not being ignored.
Update the .gitignore entry to keep the /public/build ignore rule separate from
the “Sentry Config File” comment, using the .gitignore entry itself as the
unique locator.
In `@examples/react/start-basic-rsbuild/public/site.webmanifest`:
- Around line 2-3: The web manifest currently has empty app metadata, so
populate the manifest fields in site.webmanifest by setting meaningful values
for name and short_name. Update the manifest entries directly so the example app
exposes proper install prompt text and home-screen labels when linked from the
root document.
In `@examples/react/start-basic-rsbuild/src/components/DefaultCatchBoundary.tsx`:
- Around line 37-43: The back navigation in DefaultCatchBoundary should not rely
only on window.history.back(), since direct loads or non-app history can leave
users stranded or exit the app. Update the Link onClick handler to check whether
there is a usable in-app history entry and fall back to navigating to the app
root ("/") when there is not, keeping the existing Link and DefaultCatchBoundary
behavior intact.
In `@examples/react/start-basic-rsbuild/src/routes/__root.tsx`:
- Line 49: The manifest link definition in the __root route uses an invalid
5-digit hex color value, so update the color field in the object that defines
the site.webmanifest link to a valid 6-digit CSS hex color; specifically fix the
manifest metadata entry alongside the rel:'manifest' and
href:'/site.webmanifest' fields.
In `@examples/react/start-basic-rsbuild/src/routes/users`.$userId.tsx:
- Around line 7-20: The loader in users.$userId.tsx is swallowing the 404 path,
so notFoundComponent can never be reached. Update the loader to call notFound()
directly when fetch('/api/users/' + userId) returns a non-ok 404 response, and
avoid catching that notFound throw in the surrounding try/catch. Keep the
existing UserErrorComponent path for real failures, but ensure the not-found
case in the loader routes to the dedicated NotFound UI.
---
Nitpick comments:
In `@examples/react/start-basic-rsbuild/src/components/NotFound.tsx`:
- Line 3: The NotFound component’s children prop is typed too loosely with any,
which breaks TypeScript safety. Update the NotFound function signature to use
React.ReactNode for children, matching the typing used in RootDocument in
__root.tsx, and keep the prop optional if needed.
In `@examples/react/start-basic-rsbuild/src/routes/api/users.ts`:
- Around line 30-35: The commented-out dead code in the users route should be
removed to keep the example clean. Delete the unused conditional redirect block
from the api users handler in the relevant route module, and ensure the
remaining route logic in the same file stays unchanged and readable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4f556486-3f1c-4460-abb8-cd9ea6174934
⛔ Files ignored due to path filters (8)
examples/react/start-basic-rsbuild/public/android-chrome-192x192.pngis excluded by!**/*.pngexamples/react/start-basic-rsbuild/public/android-chrome-512x512.pngis excluded by!**/*.pngexamples/react/start-basic-rsbuild/public/apple-touch-icon.pngis excluded by!**/*.pngexamples/react/start-basic-rsbuild/public/favicon-16x16.pngis excluded by!**/*.pngexamples/react/start-basic-rsbuild/public/favicon-32x32.pngis excluded by!**/*.pngexamples/react/start-basic-rsbuild/public/favicon.icois excluded by!**/*.icoexamples/react/start-basic-rsbuild/public/favicon.pngis excluded by!**/*.pngpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (40)
docs/start/framework/react/getting-started.mdexamples/react/start-basic-rsbuild/.devcontainer/devcontainer.jsonexamples/react/start-basic-rsbuild/.gitignoreexamples/react/start-basic-rsbuild/.prettierignoreexamples/react/start-basic-rsbuild/.vscode/settings.jsonexamples/react/start-basic-rsbuild/README.mdexamples/react/start-basic-rsbuild/package.jsonexamples/react/start-basic-rsbuild/public/site.webmanifestexamples/react/start-basic-rsbuild/rsbuild.config.tsexamples/react/start-basic-rsbuild/src/components/DefaultCatchBoundary.tsxexamples/react/start-basic-rsbuild/src/components/NotFound.tsxexamples/react/start-basic-rsbuild/src/components/PostError.tsxexamples/react/start-basic-rsbuild/src/components/UserError.tsxexamples/react/start-basic-rsbuild/src/env.d.tsexamples/react/start-basic-rsbuild/src/routeTree.gen.tsexamples/react/start-basic-rsbuild/src/router.tsxexamples/react/start-basic-rsbuild/src/routes/__root.tsxexamples/react/start-basic-rsbuild/src/routes/_pathlessLayout.tsxexamples/react/start-basic-rsbuild/src/routes/_pathlessLayout/_nested-layout.tsxexamples/react/start-basic-rsbuild/src/routes/_pathlessLayout/_nested-layout/route-a.tsxexamples/react/start-basic-rsbuild/src/routes/_pathlessLayout/_nested-layout/route-b.tsxexamples/react/start-basic-rsbuild/src/routes/api/users.$userId.tsexamples/react/start-basic-rsbuild/src/routes/api/users.tsexamples/react/start-basic-rsbuild/src/routes/customScript[.]js.tsexamples/react/start-basic-rsbuild/src/routes/deferred.tsxexamples/react/start-basic-rsbuild/src/routes/index.tsxexamples/react/start-basic-rsbuild/src/routes/posts.$postId.tsxexamples/react/start-basic-rsbuild/src/routes/posts.index.tsxexamples/react/start-basic-rsbuild/src/routes/posts.tsxexamples/react/start-basic-rsbuild/src/routes/posts_.$postId.deep.tsxexamples/react/start-basic-rsbuild/src/routes/redirect.tsxexamples/react/start-basic-rsbuild/src/routes/users.$userId.tsxexamples/react/start-basic-rsbuild/src/routes/users.index.tsxexamples/react/start-basic-rsbuild/src/routes/users.tsxexamples/react/start-basic-rsbuild/src/styles/app.cssexamples/react/start-basic-rsbuild/src/utils/loggingMiddleware.tsxexamples/react/start-basic-rsbuild/src/utils/posts.tsxexamples/react/start-basic-rsbuild/src/utils/seo.tsexamples/react/start-basic-rsbuild/src/utils/users.tsxexamples/react/start-basic-rsbuild/tsconfig.json
…basic-rsbuild # Conflicts: # pnpm-lock.yaml
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Add a new React Start
start-basic-rsbuildexample using Rsbuild.Summary by CodeRabbit