Skip to content

Commit 1ec28d2

Browse files
justin808claude
andcommitted
Fix remaining force_load references after rename to immediate_hydration
- Update test files to use immediate_hydration instead of force_load - Fix spec/dummy/spec/helpers/react_on_rails_helper_spec.rb - Fix spec/react_on_rails/react_component/render_options_spec.rb - Fix spec/dummy/app/views/pages/turbo_stream_send_hello_world.turbo_stream.erb - Update CHANGELOG.md with correct naming and default value - Update warning message expectations in tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b654935 commit 1ec28d2

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ See [Release Notes](docs/release-notes/15.0.0.md) for full details.
4040
- For TypeScript errors, upgrade to TypeScript 5.8+ and set `module` to `nodenext`.
4141
- `ReactOnRails.reactOnRailsPageLoaded` is now an async function. Migration:
4242
- Add `await` when calling this function: `await ReactOnRails.reactOnRailsPageLoaded()`.
43-
- `force_load` configuration now defaults to `true`. Migration:
44-
- Set `force_load: false` in your config if you want the previous behavior.
43+
- `immediate_hydration` configuration now defaults to `false`. Migration:
44+
- Set `immediate_hydration: true` in your config if you want immediate hydration behavior.
4545

4646
For detailed migration instructions, see the [15.0.0 Release Notes](docs/release-notes/15.0.0.md).
4747

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<%= turbo_stream.update 'hello-turbo-stream' do %>
2-
<%= react_component("HelloTurboStream", props: @app_props_hello_from_turbo_stream, force_load: true) %>
2+
<%= react_component("HelloTurboStream", props: @app_props_hello_from_turbo_stream, immediate_hydration: true) %>
33
<% end %>

spec/dummy/spec/helpers/react_on_rails_helper_spec.rb

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -355,23 +355,23 @@ def helper.append_javascript_pack_tag(name, **options)
355355
it { is_expected.to include '<div id="App-react-component-0"></div>' }
356356
end
357357

358-
describe "'force_load' tag option" do
359-
let(:force_load_script) do
358+
describe "'immediate_hydration' tag option" do
359+
let(:immediate_hydration_script) do
360360
%(
361361
typeof ReactOnRails === 'object' && ReactOnRails.reactOnRailsComponentLoaded('App-react-component-0');
362362
).html_safe
363363
end
364364

365-
context "with 'force_load' == false" do
366-
subject { react_component("App", force_load: false) }
365+
context "with 'immediate_hydration' == false" do
366+
subject { react_component("App", immediate_hydration: false) }
367367

368-
it { is_expected.not_to include force_load_script }
368+
it { is_expected.not_to include immediate_hydration_script }
369369
end
370370

371-
context "without 'force_load' tag option" do
371+
context "without 'immediate_hydration' tag option" do
372372
subject { react_component("App") }
373373

374-
it { is_expected.to include force_load_script }
374+
it { is_expected.to include immediate_hydration_script }
375375
end
376376
end
377377

@@ -382,8 +382,8 @@ def helper.append_javascript_pack_tag(name, **options)
382382
allow(Rails.logger).to receive(:warn)
383383
end
384384

385-
context "when Pro license is NOT installed and force_load is true" do
386-
subject(:react_app) { react_component("App", props: props, force_load: true) }
385+
context "when Pro license is NOT installed and immediate_hydration is true" do
386+
subject(:react_app) { react_component("App", props: props, immediate_hydration: true) }
387387

388388
before do
389389
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro_licence_valid?).and_return(false)
@@ -393,28 +393,28 @@ def helper.append_javascript_pack_tag(name, **options)
393393

394394
it "logs a warning" do
395395
react_app
396-
expect(Rails.logger).to have_received(:warn).with(a_string_matching(/The 'force_load' feature requires/))
396+
expect(Rails.logger).to have_received(:warn).with(a_string_matching(/The 'immediate_hydration' feature requires/))
397397
end
398398
end
399399

400-
context "when Pro license is NOT installed and global force_load is true" do
400+
context "when Pro license is NOT installed and global immediate_hydration is true" do
401401
subject(:react_app) { react_component("App", props: props) }
402402

403403
before do
404404
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro_licence_valid?).and_return(false)
405405
end
406406

407407
around do |example|
408-
ReactOnRails.configure { |config| config.force_load = true }
408+
ReactOnRails.configure { |config| config.immediate_hydration = true }
409409
example.run
410-
ReactOnRails.configure { |config| config.force_load = false }
410+
ReactOnRails.configure { |config| config.immediate_hydration = false }
411411
end
412412

413413
it { is_expected.to include(badge_html_string) }
414414
end
415415

416-
context "when Pro license is NOT installed and force_load is false" do
417-
subject(:react_app) { react_component("App", props: props, force_load: false) }
416+
context "when Pro license is NOT installed and immediate_hydration is false" do
417+
subject(:react_app) { react_component("App", props: props, immediate_hydration: false) }
418418

419419
before do
420420
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro_licence_valid?).and_return(false)
@@ -428,8 +428,8 @@ def helper.append_javascript_pack_tag(name, **options)
428428
end
429429
end
430430

431-
context "when Pro license IS installed and force_load is true" do
432-
subject(:react_app) { react_component("App", props: props, force_load: true) }
431+
context "when Pro license IS installed and immediate_hydration is true" do
432+
subject(:react_app) { react_component("App", props: props, immediate_hydration: true) }
433433

434434
before do
435435
allow(ReactOnRails::Utils).to receive_messages(
@@ -475,8 +475,8 @@ def helper.append_javascript_pack_tag(name, **options)
475475
allow(Rails.logger).to receive(:warn)
476476
end
477477

478-
context "when Pro license is NOT installed and force_load is true" do
479-
subject(:react_app) { react_component_hash("App", props: props, force_load: true) }
478+
context "when Pro license is NOT installed and immediate_hydration is true" do
479+
subject(:react_app) { react_component_hash("App", props: props, immediate_hydration: true) }
480480

481481
before do
482482
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro_licence_valid?).and_return(false)
@@ -487,8 +487,8 @@ def helper.append_javascript_pack_tag(name, **options)
487487
end
488488
end
489489

490-
context "when Pro license IS installed and force_load is true" do
491-
subject(:react_app) { react_component_hash("App", props: props, force_load: true) }
490+
context "when Pro license IS installed and immediate_hydration is true" do
491+
subject(:react_app) { react_component_hash("App", props: props, immediate_hydration: true) }
492492

493493
before do
494494
allow(ReactOnRails::Utils).to receive_messages(
@@ -504,7 +504,7 @@ def helper.append_javascript_pack_tag(name, **options)
504504
end
505505

506506
describe "#redux_store" do
507-
subject(:store) { redux_store("reduxStore", props: props, force_load: true) }
507+
subject(:store) { redux_store("reduxStore", props: props, immediate_hydration: true) }
508508

509509
let(:props) do
510510
{ name: "My Test Name" }
@@ -533,8 +533,8 @@ def helper.append_javascript_pack_tag(name, **options)
533533
allow(Rails.logger).to receive(:warn)
534534
end
535535

536-
context "when Pro license is NOT installed and force_load is true" do
537-
subject(:store) { redux_store("reduxStore", props: props, force_load: true) }
536+
context "when Pro license is NOT installed and immediate_hydration is true" do
537+
subject(:store) { redux_store("reduxStore", props: props, immediate_hydration: true) }
538538

539539
before do
540540
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro_licence_valid?).and_return(false)
@@ -544,12 +544,12 @@ def helper.append_javascript_pack_tag(name, **options)
544544

545545
it "logs a warning" do
546546
store
547-
expect(Rails.logger).to have_received(:warn).with(a_string_matching(/The 'force_load' feature requires/))
547+
expect(Rails.logger).to have_received(:warn).with(a_string_matching(/The 'immediate_hydration' feature requires/))
548548
end
549549
end
550550

551-
context "when Pro license is NOT installed and force_load is false" do
552-
subject(:store) { redux_store("reduxStore", props: props, force_load: false) }
551+
context "when Pro license is NOT installed and immediate_hydration is false" do
552+
subject(:store) { redux_store("reduxStore", props: props, immediate_hydration: false) }
553553

554554
before do
555555
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro_licence_valid?).and_return(false)
@@ -558,8 +558,8 @@ def helper.append_javascript_pack_tag(name, **options)
558558
it { is_expected.not_to include(badge_html_string) }
559559
end
560560

561-
context "when Pro license IS installed and force_load is true" do
562-
subject(:store) { redux_store("reduxStore", props: props, force_load: true) }
561+
context "when Pro license IS installed and immediate_hydration is true" do
562+
subject(:store) { redux_store("reduxStore", props: props, immediate_hydration: true) }
563563

564564
before do
565565
allow(ReactOnRails::Utils).to receive_messages(

spec/react_on_rails/react_component/render_options_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
replay_console
1010
raise_on_prerender_error
1111
random_dom_id
12-
force_load
12+
immediate_hydration
1313
].freeze
1414

1515
def the_attrs(react_component_name: "App", options: {})

0 commit comments

Comments
 (0)