Skip to content

Improve RSC pages to follow React on Rails RSC migration guide best practices #25

@AbanoubGhadban

Description

@AbanoubGhadban

Summary

Audit and improve all RSC page implementations in the demo to align with the React on Rails RSC migration guide best practices. The demo serves as a reference for RSC adoption, so each page should showcase recommended patterns.

RSC Pages to Review

  • Product Page (/product/rsc) — ProductPageRSC
  • Product Search (/product-search/rsc) — ProductSearchRSC
  • Dashboard Analytics (/analytics/rsc) — DashboardPageRSC
  • Blog Post (/blog/rsc) — BlogPostRSC
  • Restaurant Search (/search/rsc) — SearchPageRSC

Areas to Evaluate

Component Organization

  • Proper 'use client' boundary placement — only on leaf interactive components
  • Server components should not import client-only code
  • Verify no unnecessary client components (components that could remain server-side)

Data Fetching & Streaming

  • Async prop streaming order is optimized (critical content first)
  • Suspense boundaries with meaningful skeleton fallbacks
  • Sync vs async prop split follows best practices (minimal sync props for fast initial paint)

Bundle Size

  • Confirm heavy libraries (d3, marked, highlight.js) stay server-side in RSC variants
  • Verify client JS is minimal (only interactive islands hydrate)
  • No unintended client bundle bloat from server component imports

Controller & View Patterns

  • stream_react_component_with_async_props usage follows latest API
  • emit.call ordering and naming conventions are consistent
  • Proper use of enable_async_react_rendering and stream_view_containing_react_components

Error Handling & Loading States

  • Error boundaries around async sections
  • Skeleton/loading fallbacks for all Suspense boundaries
  • Graceful degradation if streaming fails

Performance

  • No waterfall data fetching in controllers (parallelize where possible)
  • Appropriate highWaterMark settings for streams
  • Efficient serialization (no over-fetching data in props)

Acceptance Criteria

  • Each RSC page reviewed against migration guide best practices
  • Identified improvements documented and implemented
  • Demo remains a clear reference for each rendering pattern (SSR vs Client vs RSC)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions