Commit 4cc2aeb
Fix FOUC by rendering body first to collect appends, then head with pack tags
Solution:
- Wrap body content in content_for :body_content at TOP of layout
- This executes all react_component calls first, triggering auto-appends
- Then render head with append calls followed by main pack tags
- Finally yield body content
Execution order:
1. content_for :body_content executes (all react_component auto-appends happen)
2. Explicit append_*_pack_tag calls in head
3. stylesheet_pack_tag and javascript_pack_tag in head (with all appends registered)
4. yield :body_content outputs the body
Result: Stylesheets load in head, eliminating FOUC, while preserving
auto_load_bundle functionality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 5f7c02b commit 4cc2aeb
File tree
2 files changed
+24
-20
lines changed- app/views/layouts
2 files changed
+24
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
1 | 14 | | |
2 | 15 | | |
3 | 16 | | |
| |||
8 | 21 | | |
9 | 22 | | |
10 | 23 | | |
11 | | - | |
12 | 24 | | |
13 | 25 | | |
14 | 26 | | |
15 | 27 | | |
16 | 28 | | |
17 | 29 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
7 | 16 | | |
8 | 17 | | |
9 | 18 | | |
10 | | - | |
11 | 19 | | |
12 | 20 | | |
13 | 21 | | |
14 | 22 | | |
15 | 23 | | |
16 | 24 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
0 commit comments