Skip to content

Commit 8a1332e

Browse files
Update client startup behavior and configuration settings
- Modified the client startup process to use a setTimeout for improved execution timing. - Enabled auto-loading of bundles in the React on Rails initializer and added an option for immediate hydration. These changes enhance the initialization process and improve the overall performance of the application.
1 parent 79c2400 commit 8a1332e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/react-on-rails/src/ReactOnRails.client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ globalThis.ReactOnRails = {
194194

195195
globalThis.ReactOnRails.resetOptions();
196196

197-
ClientStartup.clientStartup();
197+
setTimeout(() => {
198+
ClientStartup.clientStartup();
199+
}, 0);
198200

199201
export * from './types/index.ts';
200202
export default globalThis.ReactOnRails;

spec/dummy/config/initializers/react_on_rails.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def self.adjust_props_for_client_side_hydration(component_name, props)
4040

4141
config.rendering_props_extension = RenderingPropsExtension
4242
config.components_subdirectory = "startup"
43-
config.auto_load_bundle = false
43+
config.auto_load_bundle = true
44+
config.immediate_hydration = false
4445
config.generated_component_packs_loading_strategy = :defer
4546
end

0 commit comments

Comments
 (0)