Skip to content

Commit 3cab5c4

Browse files
justin808claude
andcommitted
Fix test to expect defer: true for default loading strategy
The default loading strategy was changed to :defer (from :async) to prevent race conditions. The test was incorrectly still expecting async behavior when async is supported. Now correctly expects { defer: true } for the default behavior, which matches the configuration change in commit 4faf810. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4faf810 commit 3cab5c4

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

spec/dummy/spec/helpers/react_on_rails_helper_spec.rb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,9 @@ def self.pro_attribution_comment
7777
allow(helper).to receive(:append_stylesheet_pack_tag)
7878
expect { helper.load_pack_for_generated_component("component_name", render_options) }.not_to raise_error
7979

80-
# Expect the default loading strategy based on Shakapacker version
81-
if ReactOnRails::PackerUtils.supports_async_loading?
82-
expect(helper).to have_received(:append_javascript_pack_tag).with("generated/component_name",
83-
{ defer: false, async: true })
84-
else
85-
# When async is not supported, defaults to :defer which means { defer: true }
86-
expect(helper).to have_received(:append_javascript_pack_tag).with("generated/component_name", { defer: true })
87-
end
80+
# Default loading strategy is now always :defer to prevent race conditions
81+
# between component registration and hydration, regardless of async support
82+
expect(helper).to have_received(:append_javascript_pack_tag).with("generated/component_name", { defer: true })
8883
expect(helper).to have_received(:append_stylesheet_pack_tag).with("generated/component_name")
8984
end
9085

0 commit comments

Comments
 (0)