Skip to content

Commit fa9361a

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 <noreply@anthropic.com>
1 parent ec52aa1 commit fa9361a

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
@@ -6,6 +6,7 @@
66
<title>RailsReactTutorial</title>
77

88
<%= append_stylesheet_pack_tag('stimulus-bundle') %>
9+
<%= stylesheet_pack_tag(media: 'all', 'data-turbolinks-track': true) %>
910
<%= append_javascript_pack_tag('stimulus-bundle') %>
1011
<%= append_javascript_pack_tag('stores-registration') %>
1112

@@ -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)