Skip to content

Commit 539c35c

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 <noreply@anthropic.com>
1 parent 8b26575 commit 539c35c

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
@@ -269,6 +269,8 @@ GEM
269269
rb-fsevent (0.11.2)
270270
rb-inotify (0.10.1)
271271
ffi (~> 1.0)
272+
rbs (3.9.5)
273+
logger
272274
rdoc (6.14.2)
273275
erb
274276
psych (>= 4.0.0)
@@ -382,9 +384,6 @@ GEM
382384
actionpack (>= 6.0.0)
383385
activejob (>= 6.0.0)
384386
railties (>= 6.0.0)
385-
turbolinks (5.2.1)
386-
turbolinks-source (~> 5.2)
387-
turbolinks-source (5.2.0)
388387
tzinfo (2.0.6)
389388
concurrent-ruby (~> 1.0)
390389
uglifier (4.2.0)
@@ -433,6 +432,7 @@ DEPENDENCIES
433432
pry-rescue
434433
puma (~> 6.0)
435434
rails (~> 7.1)
435+
rbs
436436
react_on_rails!
437437
rspec-rails
438438
rspec-retry
@@ -449,7 +449,6 @@ DEPENDENCIES
449449
sprockets (~> 4.0)
450450
sqlite3 (~> 1.6)
451451
turbo-rails
452-
turbolinks
453452
uglifier
454453
webdrivers (= 5.3.0)
455454

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)