Skip to content

Commit aecf463

Browse files
justin808claude
andcommitted
Fix FOUC by moving stylesheet loading to head section
The stylesheet_pack_tag was loading at the bottom of the body, causing a flash of unstyled content (FOUC) as React components rendered before CSS loaded. Moving it to the head ensures styles are loaded before content renders. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ec52aa1 commit aecf463

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/views/layouts/application.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>RailsReactTutorial</title>
77

8+
<%= stylesheet_pack_tag(media: 'all', 'data-turbolinks-track': true) %>
89
<%= append_stylesheet_pack_tag('stimulus-bundle') %>
910
<%= append_javascript_pack_tag('stimulus-bundle') %>
1011
<%= append_javascript_pack_tag('stores-registration') %>
@@ -20,7 +21,6 @@
2021

2122
<%= react_component "Footer" %>
2223

23-
<%= stylesheet_pack_tag(media: 'all', 'data-turbolinks-track': true) %>
2424
<%= javascript_pack_tag('data-turbolinks-track': true, defer: true) %>
2525

2626
<!-- This is a placeholder for ReactOnRails to know where to render the store props for

0 commit comments

Comments
 (0)