Skip to content

chore: add React Start basic Rsbuild example#7729

Open
SyMind wants to merge 3 commits into
TanStack:mainfrom
SyMind:start-basic-rsbuild
Open

chore: add React Start basic Rsbuild example#7729
SyMind wants to merge 3 commits into
TanStack:mainfrom
SyMind:start-basic-rsbuild

Conversation

@SyMind

@SyMind SyMind commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Add a new React Start start-basic-rsbuild example using Rsbuild.

Summary by CodeRabbit

  • New Features
    • Added a new React “Basic + Rsbuild” example featuring file-based routing, list/detail pages, redirects, deferred loading, and server-backed JSON endpoints.
    • Included built-in error, not-found, and retry UI, plus basic SEO and logging middleware.
  • Documentation
    • Updated the React getting-started guide to include the new “Basic + Rsbuild” example and added example setup/run documentation.
  • Chores
    • Added example configuration for container/dev tooling, formatting ignores, editor exclusions, and a web app manifest.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 96044dcc-291e-4ced-a437-d490ab594e74

📥 Commits

Reviewing files that changed from the base of the PR and between abeaffe and 70a2f11.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • examples/react/start-basic-rsbuild/package.json
✅ Files skipped from review due to trivial changes (1)
  • examples/react/start-basic-rsbuild/package.json

📝 Walkthrough

Walkthrough

This PR adds a new start-basic-rsbuild React example under examples/react/, with Rsbuild-based project setup, a generated router tree, route modules for posts/users/deferred/API flows, shared utilities, and a docs entry.

Changes

start-basic-rsbuild example app

Layer / File(s) Summary
Project scaffolding and build configuration
examples/react/start-basic-rsbuild/package.json, tsconfig.json, rsbuild.config.ts, .devcontainer/devcontainer.json, .gitignore, .prettierignore, .vscode/settings.json, README.md, public/site.webmanifest, src/env.d.ts, docs/start/framework/react/getting-started.md
Adds package metadata, TypeScript and Rsbuild setup, devcontainer and ignore rules, editor settings, README, manifest, ambient types, and the example listing entry.
Router setup and root document
examples/react/start-basic-rsbuild/src/routeTree.gen.ts, src/router.tsx, src/routes/__root.tsx, src/components/DefaultCatchBoundary.tsx, src/components/NotFound.tsx, src/styles/app.css
Adds the generated route tree, router factory, root route shell and metadata, default error/not-found UI, and global styling.
Pathless layout routes
examples/react/start-basic-rsbuild/src/routes/_pathlessLayout*
Adds nested pathless layout routes with wrapper outlets and active-link navigation.
Posts routes and server functions
examples/react/start-basic-rsbuild/src/routes/posts*, src/routes/redirect.tsx, src/components/PostError.tsx, src/utils/posts.tsx
Adds posts list/detail/deep routes, a redirect route, and shared post-fetch server functions and error handling.
Users routes and API endpoints
examples/react/start-basic-rsbuild/src/routes/users*, src/routes/api/users*, src/components/UserError.tsx, src/utils/users.tsx
Adds users list/detail/index routes, the users API routes, middleware, and the shared user type/error UI.
Home, deferred data, custom script, SEO, and logging middleware
examples/react/start-basic-rsbuild/src/routes/index.tsx, src/routes/deferred.tsx, src/routes/customScript[.]js.ts, src/utils/seo.ts, src/utils/loggingMiddleware.tsx
Adds the home route, deferred-loading demo, custom JavaScript route, SEO helper, and timing middleware.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a new React Start basic Rsbuild example.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 value

Remove 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 win

Avoid any for children prop.

children?: any weakens type safety; React.ReactNode is the correct type here and is already used the same way in __root.tsx's RootDocument.

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

📥 Commits

Reviewing files that changed from the base of the PR and between ecbbd9a and abeaffe.

⛔ Files ignored due to path filters (8)
  • examples/react/start-basic-rsbuild/public/android-chrome-192x192.png is excluded by !**/*.png
  • examples/react/start-basic-rsbuild/public/android-chrome-512x512.png is excluded by !**/*.png
  • examples/react/start-basic-rsbuild/public/apple-touch-icon.png is excluded by !**/*.png
  • examples/react/start-basic-rsbuild/public/favicon-16x16.png is excluded by !**/*.png
  • examples/react/start-basic-rsbuild/public/favicon-32x32.png is excluded by !**/*.png
  • examples/react/start-basic-rsbuild/public/favicon.ico is excluded by !**/*.ico
  • examples/react/start-basic-rsbuild/public/favicon.png is excluded by !**/*.png
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (40)
  • docs/start/framework/react/getting-started.md
  • examples/react/start-basic-rsbuild/.devcontainer/devcontainer.json
  • examples/react/start-basic-rsbuild/.gitignore
  • examples/react/start-basic-rsbuild/.prettierignore
  • examples/react/start-basic-rsbuild/.vscode/settings.json
  • examples/react/start-basic-rsbuild/README.md
  • examples/react/start-basic-rsbuild/package.json
  • examples/react/start-basic-rsbuild/public/site.webmanifest
  • examples/react/start-basic-rsbuild/rsbuild.config.ts
  • examples/react/start-basic-rsbuild/src/components/DefaultCatchBoundary.tsx
  • examples/react/start-basic-rsbuild/src/components/NotFound.tsx
  • examples/react/start-basic-rsbuild/src/components/PostError.tsx
  • examples/react/start-basic-rsbuild/src/components/UserError.tsx
  • examples/react/start-basic-rsbuild/src/env.d.ts
  • examples/react/start-basic-rsbuild/src/routeTree.gen.ts
  • examples/react/start-basic-rsbuild/src/router.tsx
  • examples/react/start-basic-rsbuild/src/routes/__root.tsx
  • examples/react/start-basic-rsbuild/src/routes/_pathlessLayout.tsx
  • examples/react/start-basic-rsbuild/src/routes/_pathlessLayout/_nested-layout.tsx
  • examples/react/start-basic-rsbuild/src/routes/_pathlessLayout/_nested-layout/route-a.tsx
  • examples/react/start-basic-rsbuild/src/routes/_pathlessLayout/_nested-layout/route-b.tsx
  • examples/react/start-basic-rsbuild/src/routes/api/users.$userId.ts
  • examples/react/start-basic-rsbuild/src/routes/api/users.ts
  • examples/react/start-basic-rsbuild/src/routes/customScript[.]js.ts
  • examples/react/start-basic-rsbuild/src/routes/deferred.tsx
  • examples/react/start-basic-rsbuild/src/routes/index.tsx
  • examples/react/start-basic-rsbuild/src/routes/posts.$postId.tsx
  • examples/react/start-basic-rsbuild/src/routes/posts.index.tsx
  • examples/react/start-basic-rsbuild/src/routes/posts.tsx
  • examples/react/start-basic-rsbuild/src/routes/posts_.$postId.deep.tsx
  • examples/react/start-basic-rsbuild/src/routes/redirect.tsx
  • examples/react/start-basic-rsbuild/src/routes/users.$userId.tsx
  • examples/react/start-basic-rsbuild/src/routes/users.index.tsx
  • examples/react/start-basic-rsbuild/src/routes/users.tsx
  • examples/react/start-basic-rsbuild/src/styles/app.css
  • examples/react/start-basic-rsbuild/src/utils/loggingMiddleware.tsx
  • examples/react/start-basic-rsbuild/src/utils/posts.tsx
  • examples/react/start-basic-rsbuild/src/utils/seo.ts
  • examples/react/start-basic-rsbuild/src/utils/users.tsx
  • examples/react/start-basic-rsbuild/tsconfig.json

Comment thread examples/react/start-basic-rsbuild/.gitignore
Comment thread examples/react/start-basic-rsbuild/public/site.webmanifest
Comment thread examples/react/start-basic-rsbuild/src/routes/__root.tsx
Comment thread examples/react/start-basic-rsbuild/src/routes/users.$userId.tsx
…basic-rsbuild

# Conflicts:
#	pnpm-lock.yaml
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​rsbuild/​plugin-tailwindcss@​2.0.3691007091100
Addedsrvx@​0.11.181001009595100

View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant