Skip to content

Commit 23b25b3

Browse files
committed
fix: resolve Shakapacker append/pack tag ordering issue
- Keep pack tags at end of body to allow react_component append calls - Add data-turbo-suppress-warning to body tags to suppress Turbo warning - This fixes CI failures while maintaining Shakapacker requirements - React components can now properly append their JavaScript packs
1 parent 76f0fee commit 23b25b3

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

app/views/layouts/application.html.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@
99
<%= append_javascript_pack_tag('stimulus-bundle') %>
1010
<%= append_javascript_pack_tag('stores-registration') %>
1111

12-
<%= stylesheet_pack_tag(media: 'all', 'data-turbolinks-track': true) %>
13-
<%= javascript_pack_tag('data-turbolinks-track': true, defer: true) %>
14-
1512
<%= csrf_meta_tags %>
1613
</head>
17-
<body class="min-h-screen flex flex-col bg-sky-50 text-gray-700">
14+
<body class="min-h-screen flex flex-col bg-sky-50 text-gray-700" data-turbo-suppress-warning="true">
1815
<%= react_component "NavigationBarApp" %>
1916

2017
<div class="container mx-auto px-4 flex-grow">
@@ -23,6 +20,9 @@
2320

2421
<%= react_component "Footer" %>
2522

23+
<%= stylesheet_pack_tag(media: 'all', 'data-turbolinks-track': true) %>
24+
<%= javascript_pack_tag('data-turbolinks-track': true, defer: true) %>
25+
2626
<!-- This is a placeholder for ReactOnRails to know where to render the store props for
2727
client side hydration -->
2828
<%= redux_store_hydration_data %>

app/views/layouts/stimulus_layout.html.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99

1010
<%= append_stylesheet_pack_tag('stimulus-bundle') %>
1111
<%= append_javascript_pack_tag('stimulus-bundle') %>
12-
13-
<%= stylesheet_pack_tag(media: 'all', 'data-turbolinks-track': true) %>
14-
<%= javascript_pack_tag('data-turbolinks-track': true, defer: true) %>
1512
</head>
16-
<body class="min-h-screen flex flex-col bg-sky-50 text-gray-700">
13+
<body class="min-h-screen flex flex-col bg-sky-50 text-gray-700" data-turbo-suppress-warning="true">
1714
<%= react_component "NavigationBarApp" %>
1815

1916
<div class="container mx-auto px-4 flex-grow">
2017
<%= yield %>
2118
</div>
2219

2320
<%= react_component "Footer" %>
21+
22+
<%= stylesheet_pack_tag(media: 'all', 'data-turbolinks-track': true) %>
23+
<%= javascript_pack_tag('data-turbolinks-track': true, defer: true) %>
2424
</body>
2525
</html>

0 commit comments

Comments
 (0)