Skip to content

Commit be61ade

Browse files
justin808claude
andcommitted
Fix ImageExample registration failure with async script loading
The commit ee80bc2 changed the main client-bundle to use async: true for better performance, but left generated_component_packs_loading_strategy set to :defer in the dummy app configuration. This caused a race condition where: 1. Main bundle (async: true) executes immediately when downloaded 2. Auto-generated ImageExample pack (:defer) executes after page load 3. Main bundle tries to hydrate ImageExample before it's registered Solution: Change generated_component_packs_loading_strategy from :defer to :async to match the main bundle loading strategy and prevent the race condition. This aligns with the default behavior (async when Shakapacker >= 8.2.0) and the documentation added in ee80bc2. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 40b79b8 commit be61ade

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

spec/dummy/Gemfile.lock

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ GEM
267267
rb-fsevent (0.11.2)
268268
rb-inotify (0.10.1)
269269
ffi (~> 1.0)
270+
rbs (3.9.5)
271+
logger
270272
rdoc (6.14.2)
271273
erb
272274
psych (>= 4.0.0)
@@ -380,9 +382,6 @@ GEM
380382
actionpack (>= 6.0.0)
381383
activejob (>= 6.0.0)
382384
railties (>= 6.0.0)
383-
turbolinks (5.2.1)
384-
turbolinks-source (~> 5.2)
385-
turbolinks-source (5.2.0)
386385
tzinfo (2.0.6)
387386
concurrent-ruby (~> 1.0)
388387
uglifier (4.2.0)
@@ -430,6 +429,7 @@ DEPENDENCIES
430429
pry-rescue
431430
puma (~> 6.0)
432431
rails (~> 7.1)
432+
rbs
433433
react_on_rails!
434434
rspec-rails
435435
rspec-retry
@@ -446,7 +446,6 @@ DEPENDENCIES
446446
sprockets (~> 4.0)
447447
sqlite3 (~> 1.6)
448448
turbo-rails
449-
turbolinks
450449
uglifier
451450
webdrivers (= 5.3.0)
452451

spec/dummy/config/initializers/react_on_rails.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ def self.adjust_props_for_client_side_hydration(component_name, props)
4242
config.components_subdirectory = "startup"
4343
config.auto_load_bundle = true
4444
config.immediate_hydration = false
45-
config.generated_component_packs_loading_strategy = :defer
45+
config.generated_component_packs_loading_strategy = :async
4646
end

0 commit comments

Comments
 (0)