Skip to content

Commit ad7c916

Browse files
justin808claude
andauthored
Polish configuration error message and add test comment (#1976)
## Summary Two small improvements: better error message wording and a clarifying test comment. ## Changes - **`lib/react_on_rails/configuration.rb`**: Improve error message wording - Remove extra comma and space - Remove "which may cause performance issues" phrase - Reorder to show preferred `:defer` before `:sync` - **`spec/dummy/spec/helpers/react_on_rails_helper_spec.rb`**: Add comment explaining why defer is the default loading strategy ## Test Plan - ✅ RuboCop passes - ✅ No functional changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- Reviewable:start --> - - - This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/1976) <!-- Reviewable:end --> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 28405e3 commit ad7c916

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/react_on_rails/configuration.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ def validate_generated_component_packs_loading_strategy
172172

173173
msg = <<~MSG
174174
ReactOnRails: Your current version of shakapacker \
175-
does not support async script loading, which may cause performance issues. Please either:
176-
1. Use :sync or :defer loading strategy instead of :async
175+
does not support async script loading. Please either:
176+
1. Use :defer or :sync loading strategy instead of :async
177177
2. Upgrade to Shakapacker v8.2.0 or above to enable async script loading
178178
MSG
179179
if generated_component_packs_loading_strategy.nil?

spec/dummy/spec/helpers/react_on_rails_helper_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ 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+
# Default loading strategy is now always :defer to prevent race conditions
81+
# between component registration and hydration, regardless of async support
8082
expect(helper).to have_received(:append_javascript_pack_tag).with("generated/component_name", { defer: true })
8183
expect(helper).to have_received(:append_stylesheet_pack_tag).with("generated/component_name")
8284
end

0 commit comments

Comments
 (0)