-
Notifications
You must be signed in to change notification settings - Fork 373
Add React Server Components with React on Rails Pro #722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4d09e13
4c0df6e
2f3c42c
ae420af
05cb2bc
0d8d75a
aaeba86
92306ff
3f7e452
1022234
bc41706
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ jobs: | |
| DRIVER: selenium_chrome | ||
| CHROME_BIN: /usr/bin/google-chrome | ||
| USE_COVERALLS: true | ||
| RENDERER_PASSWORD: devPassword | ||
|
|
||
| steps: | ||
| - name: Install Chrome | ||
|
|
@@ -82,6 +83,20 @@ jobs: | |
| - name: Build shakapacker chunks | ||
| run: NODE_ENV=development bundle exec bin/shakapacker | ||
|
|
||
| - name: Start Node renderer for SSR | ||
| run: | | ||
| node react-on-rails-pro-node-renderer.js & | ||
| echo "Waiting for Node renderer on port 3800..." | ||
| for i in $(seq 1 30); do | ||
| if nc -z localhost 3800 2>/dev/null; then | ||
| echo "Node renderer is ready" | ||
| exit 0 | ||
| fi | ||
| sleep 1 | ||
| done | ||
| echo "Node renderer failed to start within 30 seconds" | ||
| exit 1 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CI starts node renderer but Rails won't use itMedium Severity The CI workflow starts the node renderer process and waits for it, but the Rails initializer only enables the node renderer when Additional Locations (1)Reviewed by Cursor Bugbot for commit bc41706. Configure here. |
||
|
|
||
| - name: Run rspec with xvfb | ||
| uses: coactions/setup-xvfb@v1 | ||
| with: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,8 @@ def simple; end | |
|
|
||
| def rescript; end | ||
|
|
||
| def server_components; end | ||
|
|
||
| private | ||
|
|
||
| def set_comments | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <%= append_javascript_pack_tag('rsc-client-components') %> | ||
| <%= react_component("ServerComponentsPage", | ||
| prerender: false, | ||
| auto_load_bundle: false, | ||
| trace: Rails.env.development?, | ||
| id: "ServerComponentsPage-react-component-0") %> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| 'use client'; | ||
justin808 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Misleading |
||
|
|
||
| // Compare to ./RouterApp.client.jsx | ||
| import { Provider } from 'react-redux'; | ||
| import React from 'react'; | ||
| import { StaticRouter } from 'react-router-dom/server'; | ||
| import ReactOnRails from 'react-on-rails'; | ||
| import ReactOnRails from 'react-on-rails-pro'; | ||
| import routes from '../../../routes/routes.jsx'; | ||
|
|
||
| function ServerRouterApp(_props, railsContext) { | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weak password hardcoded in version control. Use a GitHub Actions secret instead:
Add a fallback (e.g.
devPassword) only in the secret's default value, not in the YAML.