Skip to content

Commit f4adcd9

Browse files
committed
ran yarn start format
1 parent 24826f0 commit f4adcd9

File tree

4 files changed

+27
-21
lines changed

4 files changed

+27
-21
lines changed

.github/workflows/claude-code-review.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
# github.event.pull_request.user.login == 'external-contributor' ||
1818
# github.event.pull_request.user.login == 'new-developer' ||
1919
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20-
20+
2121
runs-on: ubuntu-latest
2222
permissions:
2323
contents: read
2424
pull-requests: read
2525
issues: read
2626
id-token: write
27-
27+
2828
steps:
2929
- name: Checkout repository
3030
uses: actions/checkout@v4
@@ -43,12 +43,11 @@ jobs:
4343
- Performance considerations
4444
- Security concerns
4545
- Test coverage
46-
46+
4747
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
4848
4949
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
50-
50+
5151
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
5252
# or https://docs.anthropic.com/en/docs/claude-code/sdk#command-line for available options
5353
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
54-

.github/workflows/claude.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
uses: anthropics/claude-code-action@v1
3636
with:
3737
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38-
38+
3939
# This is an optional setting that allows Claude to read CI results on PRs
4040
additional_permissions: |
4141
actions: read
@@ -47,4 +47,3 @@ jobs:
4747
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
4848
# or https://docs.anthropic.com/en/docs/claude-code/sdk#command-line for available options
4949
# claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)'
50-

CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,5 +347,3 @@ A fully working demo of React on Rails v15 on Rails 8, showcasing server-side re
347347
348348
📚 Part of the [React on Rails Demo Series](https://github.com/shakacode?tab=repositories&q=react_on_rails-demo)
349349
```
350-
351-

docs/guides/file-system-based-automated-bundle-generation.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ When using `auto_load_bundle: true`, your Rails layout needs to include empty pa
230230
<!-- Your regular head content -->
231231
<%= csrf_meta_tags %>
232232
<%= csp_meta_tag %>
233-
233+
234234
<!-- Empty pack tags - React on Rails injects component CSS/JS here -->
235235
<%= stylesheet_pack_tag %>
236236
<%= javascript_pack_tag %>
@@ -252,12 +252,14 @@ When using `auto_load_bundle: true`, your Rails layout needs to include empty pa
252252
**Example with multiple components:**
253253

254254
If your view contains:
255+
255256
```erb
256257
<%= react_component("HelloWorld", @hello_world_props, auto_load_bundle: true) %>
257258
<%= react_component("HeavyMarkdownEditor", @editor_props, auto_load_bundle: true) %>
258259
```
259260

260261
React on Rails automatically generates HTML equivalent to:
262+
261263
```erb
262264
<!-- In <head> where <%= stylesheet_pack_tag %> appears -->
263265
<%= stylesheet_pack_tag "generated/HelloWorld" %>
@@ -284,7 +286,7 @@ default: &default
284286
source_entry_path: packs
285287
public_root_path: public
286288
public_output_path: packs
287-
nested_entries: true # Required for auto-generation
289+
nested_entries: true # Required for auto-generation
288290
cache_manifest: false
289291
```
290292
@@ -312,7 +314,7 @@ app/javascript/
312314
│ └── ror_components/ # Auto-registration directory
313315
│ └── HelloWorld.jsx # React component
314316
└── HeavyMarkdownEditor/
315-
├── HeavyMarkdownEditor.module.css # Component styles
317+
├── HeavyMarkdownEditor.module.css # Component styles
316318
└── ror_components/ # Auto-registration directory
317319
└── HeavyMarkdownEditor.jsx # React component
318320
```
@@ -351,7 +353,7 @@ const HeavyMarkdownEditor = ({ initialContent = '# Hello\n\nStart editing!' }) =
351353
const loadMarkdown = async () => {
352354
const [{ default: ReactMarkdown }, { default: remarkGfm }] = await Promise.all([
353355
import('react-markdown'),
354-
import('remark-gfm')
356+
import('remark-gfm'),
355357
]);
356358
setReactMarkdown(() => ReactMarkdown);
357359
setRemarkGfm(() => remarkGfm);
@@ -367,11 +369,7 @@ const HeavyMarkdownEditor = ({ initialContent = '# Hello\n\nStart editing!' }) =
367369
<div className={styles.editor}>
368370
<div className={styles.input}>
369371
<h3>Markdown Input:</h3>
370-
<textarea
371-
value={content}
372-
onChange={(e) => setContent(e.target.value)}
373-
className={styles.textarea}
374-
/>
372+
<textarea value={content} onChange={(e) => setContent(e.target.value)} className={styles.textarea} />
375373
</div>
376374
<div className={styles.output}>
377375
<h3>Preview:</h3>
@@ -421,7 +419,7 @@ class HelloWorldController < ApplicationController
421419
end
422420
423421
def editor
424-
@editor_props = {
422+
@editor_props = {
425423
initialContent: "# Welcome to the Heavy Editor\n\nThis component demonstrates:\n- Dynamic imports for SSR\n- Bundle splitting\n- Automatic CSS loading"
426424
}
427425
end
@@ -449,6 +447,7 @@ bundle exec rake react_on_rails:generate_packs
449447
```
450448

451449
This creates:
450+
452451
- `app/javascript/packs/generated/HelloWorld.js`
453452
- `app/javascript/packs/generated/HeavyMarkdownEditor.js`
454453

@@ -462,14 +461,16 @@ This creates:
462461
### 9. Start the Server
463462

464463
Now when you visit your pages, React on Rails automatically:
464+
465465
- Loads only the CSS and JS needed for components on each page
466466
- Registers components without manual `ReactOnRails.register()` calls
467467
- Enables optimal bundle splitting and caching
468468

469469
**Bundle sizes in this example (measured from browser dev tools):**
470+
470471
- **HelloWorld**: 1.1MB total resources (50KB component-specific code + shared React runtime)
471472
- HelloWorld.js: 10.0 kB
472-
- HelloWorld.css: 2.5 kB
473+
- HelloWorld.css: 2.5 kB
473474
- Shared runtime: ~1.1MB (React, webpack runtime)
474475
- **HeavyMarkdownEditor**: 2.2MB total resources (2.7MB with markdown libraries)
475476
- HeavyMarkdownEditor.js: 26.5 kB
@@ -487,7 +488,7 @@ Now when you visit your pages, React on Rails automatically:
487488
**HeavyMarkdownEditor (Heavy Component):**
488489
![HeavyMarkdownEditor Bundle Analysis](../images/bundle-splitting-heavy-markdown.png)
489490

490-
*Screenshots show browser dev tools network analysis demonstrating the dramatic difference in bundle sizes and load times between the two components.*
491+
_Screenshots show browser dev tools network analysis demonstrating the dramatic difference in bundle sizes and load times between the two components._
491492

492493
### Server Rendering and Client Rendering Components
493494

@@ -513,6 +514,7 @@ As of version 13.3.4, bundles inside directories that match `config.components_s
513514
**Problem**: `react_component` helper throws "Component not found" error.
514515

515516
**Solutions**:
517+
516518
- Ensure your component is in a `ror_components` directory (or your configured `components_subdirectory`)
517519
- Run `rake react_on_rails:generate_packs` to generate the component bundles
518520
- Check that your component exports a default export: `export default MyComponent;`
@@ -525,13 +527,15 @@ As of version 13.3.4, bundles inside directories that match `config.components_s
525527
**Important**: FOUC (Flash of Unstyled Content) **only occurs with HMR (Hot Module Replacement)**. Static and production modes work perfectly without FOUC.
526528

527529
**Solutions**:
530+
528531
- **Development with HMR** (`./bin/dev`): FOUC is expected behavior due to dynamic CSS injection - **not a bug**
529532
- **Development static** (`./bin/dev static`): No FOUC - CSS is extracted to separate files like production
530533
- **Production** (`./bin/dev prod`): No FOUC - CSS is extracted and optimized
531534
- **Layout**: Verify your layout includes empty `<%= stylesheet_pack_tag %>` placeholder for CSS injection
532535
- **Component imports**: Check that CSS files are properly imported: `import styles from './Component.module.css';`
533536

534537
**Key insight**: Choose your development mode based on your current needs:
538+
535539
- Use HMR for fastest development (accept FOUC)
536540
- Use static mode when testing styling without FOUC
537541
- Use production mode for final testing
@@ -541,6 +545,7 @@ As of version 13.3.4, bundles inside directories that match `config.components_s
541545
**Problem**: Server-side rendering fails with browser-only API access.
542546

543547
**Solutions**:
548+
544549
- Use dynamic imports for browser-only libraries:
545550
```jsx
546551
useEffect(() => {
@@ -559,6 +564,7 @@ As of version 13.3.4, bundles inside directories that match `config.components_s
559564
**Problem**: Running `rake react_on_rails:generate_packs` doesn't create files.
560565

561566
**Solutions**:
567+
562568
- Verify `nested_entries: true` in `shakapacker.yml`
563569
- Check that `components_subdirectory` is correctly configured
564570
- Ensure components are in the right directory structure: `src/ComponentName/ror_components/ComponentName.jsx`
@@ -569,6 +575,7 @@ As of version 13.3.4, bundles inside directories that match `config.components_s
569575
**Problem**: Manually specified `javascript_pack_tag` or `stylesheet_pack_tag` break.
570576

571577
**Solutions**:
578+
572579
- Remove specific pack names from manual pack tags: use `<%= javascript_pack_tag %>` instead of `<%= javascript_pack_tag 'specific-bundle' %>`
573580
- Remove manual `append_javascript_pack_tag` calls - `react_component` with `auto_load_bundle: true` handles this automatically
574581
- Delete any client bundle entry files (e.g., `client-bundle.js`) that manually register components
@@ -578,6 +585,7 @@ As of version 13.3.4, bundles inside directories that match `config.components_s
578585
**Problem**: Large bundles loading when not needed.
579586

580587
**Solutions**:
588+
581589
- Use component-level bundle splitting - each page loads only needed components
582590
- Implement dynamic imports for heavy dependencies
583591
- Check bundle analysis with `RAILS_ENV=production NODE_ENV=production bundle exec rails assets:precompile` and examine generated bundle sizes
@@ -588,6 +596,7 @@ As of version 13.3.4, bundles inside directories that match `config.components_s
588596
**Problem**: Works in development but fails in production.
589597

590598
**Solutions**:
599+
591600
- **CSS**: Production extracts CSS to separate files, development might inline it
592601
- **Source maps**: Check if source maps are causing issues in production
593602
- **Minification**: Some code might break during minification - check console for errors
@@ -598,6 +607,7 @@ As of version 13.3.4, bundles inside directories that match `config.components_s
598607
**Problem**: React on Rails installation fails or behaves unexpectedly.
599608

600609
**Solutions**:
610+
601611
- **Correct order**: Always install Shakapacker BEFORE React on Rails
602612
```bash
603613
bundle add shakapacker

0 commit comments

Comments
 (0)