You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -421,7 +419,7 @@ class HelloWorldController < ApplicationController
421
419
end
422
420
423
421
def editor
424
-
@editor_props = {
422
+
@editor_props = {
425
423
initialContent: "# Welcome to the Heavy Editor\n\nThis component demonstrates:\n- Dynamic imports for SSR\n- Bundle splitting\n- Automatic CSS loading"
*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._
491
492
492
493
### Server Rendering and Client Rendering Components
493
494
@@ -513,6 +514,7 @@ As of version 13.3.4, bundles inside directories that match `config.components_s
513
514
**Problem**: `react_component` helper throws "Component not found" error.
514
515
515
516
**Solutions**:
517
+
516
518
- Ensure your component is in a `ror_components` directory (or your configured `components_subdirectory`)
517
519
- Run `rake react_on_rails:generate_packs` to generate the component bundles
518
520
- 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
525
527
**Important**: FOUC (Flash of Unstyled Content) **only occurs with HMR (Hot Module Replacement)**. Static and production modes work perfectly without FOUC.
526
528
527
529
**Solutions**:
530
+
528
531
- **Development with HMR** (`./bin/dev`): FOUC is expected behavior due to dynamic CSS injection - **not a bug**
529
532
- **Development static** (`./bin/dev static`): No FOUC - CSS is extracted to separate files like production
530
533
- **Production** (`./bin/dev prod`): No FOUC - CSS is extracted and optimized
531
534
- **Layout**: Verify your layout includes empty `<%= stylesheet_pack_tag %>` placeholder for CSS injection
532
535
- **Component imports**: Check that CSS files are properly imported: `import styles from './Component.module.css';`
533
536
534
537
**Key insight**: Choose your development mode based on your current needs:
538
+
535
539
- Use HMR for fastest development (accept FOUC)
536
540
- Use static mode when testing styling without FOUC
537
541
- Use production mode for final testing
@@ -541,6 +545,7 @@ As of version 13.3.4, bundles inside directories that match `config.components_s
541
545
**Problem**: Server-side rendering fails with browser-only API access.
542
546
543
547
**Solutions**:
548
+
544
549
- Use dynamic imports for browser-only libraries:
545
550
```jsx
546
551
useEffect(() => {
@@ -559,6 +564,7 @@ As of version 13.3.4, bundles inside directories that match `config.components_s
0 commit comments