-
Notifications
You must be signed in to change notification settings - Fork 375
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
base: master
Are you sure you want to change the base?
Changes from all commits
4d09e13
4c0df6e
2f3c42c
ae420af
05cb2bc
0d8d75a
aaeba86
92306ff
3f7e452
1022234
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 |
|---|---|---|
|
|
@@ -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'; | ||
|
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.
|
||
|
|
||
| // 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.
Security: plaintext password committed to source control
The renderer password is hardcoded in a committed file. Even for a dev environment, this trains contributors to treat passwords as cheap/throwaway and makes it easy for this to end up in a production
.envcopy-paste.Set
RENDERER_PASSWORDin.env.development(gitignored) and document it in.env.example. The password is also hardcoded as a fallback in bothreact-on-rails-pro-node-renderer.js:7andconfig/initializers/react_on_rails_pro.rb:7— remove those fallbacks too and fail fast when the env var is missing.