Skip to content

Commit cf394ba

Browse files
ihabadhamclaude
andcommitted
Add 'use client' to all registered component entry points
RSC auto-classification: files without 'use client' are registered as Server Components via registerServerComponent(). All existing components are Client Components (hooks, Redux, Router, event handlers), so they need the directive to preserve current behavior. Entry points (7 ror_components/ files): - App.jsx, NavigationBarApp.jsx, RouterApp.client.jsx, RouterApp.server.jsx (SSR wrapper, NOT a Server Component), SimpleCommentScreen.jsx, Footer.jsx, RescriptShow.jsx Pack entry files (2): - stores-registration.js, stimulus-bundle.js Per docs/oss/migrating/rsc-preparing-app.md Step 5 and docs/pro/react-server-components/create-without-ssr.md:52. Matches Justin's PR 723 final state exactly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1c4bef2 commit cf394ba

9 files changed

Lines changed: 18 additions & 0 deletions

File tree

client/app/bundles/comments/components/Footer/ror_components/Footer.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import React from 'react';
24
import PropTypes from 'prop-types';
35
import BaseComponent from 'libs/components/BaseComponent';

client/app/bundles/comments/components/SimpleCommentScreen/ror_components/SimpleCommentScreen.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
// eslint-disable-next-line max-classes-per-file
24
import React from 'react';
35
import request from 'axios';

client/app/bundles/comments/rescript/ReScriptShow/ror_components/RescriptShow.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
// Wrapper for ReScript component to work with react_on_rails auto-registration
24
// react_on_rails looks for components in ror_components/ subdirectories
35

client/app/bundles/comments/startup/App/ror_components/App.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import { Provider } from 'react-redux';
24
import React from 'react';
35
import ReactOnRails from 'react-on-rails-pro';

client/app/bundles/comments/startup/NavigationBarApp/ror_components/NavigationBarApp.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
// Top level component for client side.
24
// Compare this to the ./ServerApp.jsx file which is used for server side rendering.
35

client/app/bundles/comments/startup/RouterApp/ror_components/RouterApp.client.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
// Compare to ./RouterApp.server.jsx
24
import { Provider } from 'react-redux';
35
import React from 'react';

client/app/bundles/comments/startup/RouterApp/ror_components/RouterApp.server.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
// Compare to ./RouterApp.client.jsx
24
import { Provider } from 'react-redux';
35
import React from 'react';

client/app/packs/stimulus-bundle.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import ReactOnRails from 'react-on-rails-pro';
24
import 'jquery-ujs';
35
import { Turbo } from '@hotwired/turbo-rails';

client/app/packs/stores-registration.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import ReactOnRails from 'react-on-rails-pro';
24
import routerCommentsStore from '../bundles/comments/store/routerCommentsStore';
35
import commentsStore from '../bundles/comments/store/commentsStore';

0 commit comments

Comments
 (0)