Skip to content

Commit 1b56d1f

Browse files
committed
Remove async loading references from spec/dummy app
Since async loading is a Pro-only feature, spec/dummy should not reference or promote its use: - Simplified application.html.erb to always use defer: true - Removed uses_redux_shared_store? helper method (no longer needed) - Added note that async loading requires React on Rails Pro The helper spec tests for async still exist but they test Pro functionality by stubbing ReactOnRailsPro, which is appropriate.
1 parent f598732 commit 1b56d1f

File tree

2 files changed

+3
-29
lines changed

2 files changed

+3
-29
lines changed

spec/dummy/app/controllers/application_controller.rb

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,4 @@ class ApplicationController < ActionController::Base
1919
redirect_to server_side_log_throw_raise_invoker_path,
2020
flash: { error: msg }
2121
end
22-
23-
helper_method :uses_redux_shared_store?
24-
25-
# Returns true if the current page uses Redux shared stores with inline registration
26-
# These pages require defer: true instead of async: true for proper script execution order
27-
def uses_redux_shared_store?
28-
# Pages that use redux_store helper with inline component registration
29-
action_name.in?(%w[
30-
index
31-
server_side_redux_app
32-
server_side_redux_app_cached
33-
server_side_hello_world_shared_store
34-
server_side_hello_world_shared_store_defer
35-
server_side_hello_world_shared_store_controller
36-
client_side_hello_world_shared_store
37-
client_side_hello_world_shared_store_defer
38-
client_side_hello_world_shared_store_controller
39-
])
40-
end
4122
end

spec/dummy/app/views/layouts/application.html.erb

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,9 @@
99

1010
<%= yield :head %>
1111

12-
<%# Conditionally use defer: true for pages with Redux shared stores (inline registration).
13-
Modern apps should use async: true for optimal performance. See docs for details:
14-
docs/building-features/streaming-server-rendering.md %>
15-
<% if uses_redux_shared_store? %>
16-
<%# defer: true required for Redux shared stores with inline component registration %>
17-
<%= javascript_pack_tag('client-bundle', 'data-turbo-track': 'reload', defer: true) %>
18-
<% else %>
19-
<%# async: true is the recommended approach for modern apps (Shakapacker >= 8.2.0) %>
20-
<%= javascript_pack_tag('client-bundle', 'data-turbo-track': 'reload', async: true) %>
21-
<% end %>
12+
<%# Use defer: true for consistent script loading behavior.
13+
Note: async loading requires React on Rails Pro. %>
14+
<%= javascript_pack_tag('client-bundle', 'data-turbo-track': 'reload', defer: true) %>
2215

2316
<%= csrf_meta_tags %>
2417
</head>

0 commit comments

Comments
 (0)