Skip to content

Commit 0168c1e

Browse files
justin808claude
andcommitted
Polish configuration and improve code clarity
## Changes - **`.rubocop.yml`**: Exclude `bin/*` shell scripts from RuboCop checks - **`lib/react_on_rails/configuration.rb`**: Fix error message wording (prefer :defer over :sync, remove extra comma and "performance issues" phrase) - **`spec/dummy/spec/helpers/react_on_rails_helper_spec.rb`**: Add clarifying comment about defer default strategy Small polish changes that improve code clarity and fix minor inconsistencies. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 28405e3 commit 0168c1e

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ AllCops:
2525
- '**/node_modules/**/*'
2626
- '**/public/**/*'
2727
- '**/tmp/**/*'
28+
- 'bin/*' # Shell scripts
2829
- 'coverage/**/*'
2930
- 'gen-examples/examples/**/*'
3031
- 'node_modules/**/*'

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)