-
-
Notifications
You must be signed in to change notification settings - Fork 632
Open
Description
Summary
The RSC migration guide series (#2460) is well-written but ~60-70% of the framework-specific content targets Next.js rather than React on Rails. Each document needs React on Rails-specific sections or callouts.
Missing React on Rails Concepts
The following core concepts are barely or never mentioned across all 6 docs:
- Component registration:
ReactOnRails.register()vsregisterServerComponent()— what changes during migration? - View helpers:
stream_react_component,stream_react_component_with_async_props,rsc_payload_react_component_with_async_props - ERB integration: "After" migration examples should show both the ERB view and the React component
- Rails controller patterns: How data flows from controllers to RSC components via props
- Shakapacker/Webpack: RSC configuration, bundle analysis with
webpack-bundle-analyzer - Node renderer architecture: React on Rails Pro specifics
@loadable/component: Migration path from@loadable/component(common in React on Rails) to RSC code splitting
Next.js-Specific Content That Needs React on Rails Equivalents
| Next.js Pattern | React on Rails Equivalent Needed |
|---|---|
cookies() from next/headers (Auth, Theme, i18n providers) |
Controller props from current_user, Rails cookies, i18n-js |
app/products/page.jsx file naming |
Standalone component files registered with React on Rails |
revalidatePath() |
Rails controller redirect / Turbo |
router.refresh() from next/navigation |
React on Rails equivalent |
optimizePackageImports in next.config.js |
sideEffects: false / Webpack aliases in Shakapacker |
NEXT_PUBLIC_ / VITE_ env var prefixes |
Shakapacker env var handling |
@next/bundle-analyzer |
webpack-bundle-analyzer with Shakapacker |
next-intl for i18n |
i18n-js or Rails I18n passed as props |
Single App.jsx root assumption |
Multiple registered component roots per page |
Per-Document Gaps
migrating-to-rsc.md— Doesn't clarify if RSC is Pro-only; no mention of view helpersrsc-component-patterns.md— Zero React on Rails content; "top-down migration" should start from Rails views, notApp.jsxrsc-context-and-state.md— Auth/Theme/i18n providers are entirely Next.js-specificrsc-data-fetching.md— Best of the bunch (has async props section), but missingstream_react_component(sync) migration and ERB-side examplesrsc-third-party-libs.md— Missing@loadable/componentguidance;optimizePackageImportsis Next.js-onlyrsc-troubleshooting.md— Missing React on Rails-specific issues entirely
Recommendation
Each section using Next.js-specific APIs should either:
- Have a parallel "In React on Rails" section showing the equivalent pattern
- Be clearly labeled as "Next.js-specific" with a note about the React on Rails approach
- Or be replaced entirely with React on Rails patterns
Related: #2460
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels