Skip to content

Commit fe22829

Browse files
committed
Update specs to expect :defer as default loading strategy
Updates configuration_spec.rb to reflect the new default behavior where generated_component_packs_loading_strategy defaults to :defer instead of :async (Shakapacker >= 8.2.0) or :sync (Shakapacker < 8.2.0). This change aligns with the race condition fix that makes :defer the universal default to ensure component registrations complete before React hydration.
1 parent 5abe219 commit fe22829

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

spec/react_on_rails/configuration_spec.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ module ReactOnRails
284284
.with("8.2.0").and_return(true)
285285
end
286286

287-
it "defaults to :async" do
287+
it "defaults to :defer" do
288288
ReactOnRails.configure {} # rubocop:disable Lint/EmptyBlock
289-
expect(ReactOnRails.configuration.generated_component_packs_loading_strategy).to eq(:async)
289+
expect(ReactOnRails.configuration.generated_component_packs_loading_strategy).to eq(:defer)
290290
end
291291

292292
it "accepts :async value" do
@@ -332,10 +332,9 @@ module ReactOnRails
332332
allow(Rails.logger).to receive(:warn)
333333
end
334334

335-
it "defaults to :sync and logs a warning" do
335+
it "defaults to :defer" do
336336
ReactOnRails.configure {} # rubocop:disable Lint/EmptyBlock
337-
expect(ReactOnRails.configuration.generated_component_packs_loading_strategy).to eq(:sync)
338-
expect(Rails.logger).to have_received(:warn).with(/does not support async script loading/)
337+
expect(ReactOnRails.configuration.generated_component_packs_loading_strategy).to eq(:defer)
339338
end
340339

341340
it "accepts :defer value" do

0 commit comments

Comments
 (0)