Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions spec/dummy/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,4 @@ class ApplicationController < ActionController::Base
redirect_to server_side_log_throw_raise_invoker_path,
flash: { error: msg }
end

helper_method :uses_redux_shared_store?

# Returns true if the current page uses Redux shared stores with inline registration
# These pages require defer: true instead of async: true for proper script execution order
def uses_redux_shared_store?
# Pages that use redux_store helper with inline component registration
action_name.in?(%w[
index
server_side_redux_app
server_side_redux_app_cached
server_side_hello_world_shared_store
server_side_hello_world_shared_store_defer
server_side_hello_world_shared_store_controller
client_side_hello_world_shared_store
client_side_hello_world_shared_store_defer
client_side_hello_world_shared_store_controller
])
end
end
11 changes: 1 addition & 10 deletions spec/dummy/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@

<%= yield :head %>

<%# Conditionally use defer: true for pages with Redux shared stores (inline registration).
Modern apps should use async: true for optimal performance. See docs for details:
docs/building-features/streaming-server-rendering.md %>
<% if uses_redux_shared_store? %>
<%# defer: true required for Redux shared stores with inline component registration %>
<%= javascript_pack_tag('client-bundle', 'data-turbo-track': 'reload', defer: true) %>
<% else %>
<%# async: true is the recommended approach for modern apps (Shakapacker >= 8.2.0) %>
<%= javascript_pack_tag('client-bundle', 'data-turbo-track': 'reload', async: true) %>
<% end %>
<%= javascript_pack_tag('client-bundle', 'data-turbo-track': 'reload', defer: true) %>

<%= csrf_meta_tags %>
</head>
Expand Down
Loading