Skip to content

Commit c950a9e

Browse files
Update selective hydration documentation for React on Rails
1 parent 19e39c9 commit c950a9e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/selective-hydration-in-streamed-components.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ This happens because React on Rails by default adds the scripts that hydrate com
5555

5656
This default behavior was kept for backward compatibility, as there were previously race conditions that could occur when using `async` scripts before the page fully loaded. However, these race conditions have been fixed in the latest React on Rails release.
5757

58-
To enable true selective hydration, we need to configure React on Rails to load scripts as `async` scripts by adding `defer_generated_component_packs: false` to the React on Rails initializer:
58+
To enable true selective hydration, we need to ensure React on Rails loads scripts as `async` scripts by setting `generated_component_packs_loading_strategy` to `async` (setting it to `sync` will work as well but with lower performance). Check the [React on Rails v15.0.0 release notes](https://github.com/shakacode/react_on_rails/blob/master/docs/release-notes/15.0.0.md#enhanced-script-loading-strategies) for more details about its default behavior and how to set it to `async`.
5959

6060
```ruby
6161
# config/initializers/react_on_rails.rb
6262
ReactOnRails.configure do |config|
63-
config.defer_generated_component_packs = false
63+
config.generated_component_packs_loading_strategy = :async
6464
end
6565
```
6666

0 commit comments

Comments
 (0)