Skip to content

Commit 280ba06

Browse files
Update configuration to enable force_load by default and modify redux_store helper
1 parent 005c29a commit 280ba06

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

lib/react_on_rails/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def self.configuration
4545
make_generated_server_bundle_the_entrypoint: false,
4646
defer_generated_component_packs: true,
4747
# forces the loading of React components
48-
force_load: false,
48+
force_load: true,
4949
# Maximum time in milliseconds to wait for client-side component registration after page load.
5050
# If exceeded, an error will be thrown for server-side rendered components not registered on the client.
5151
# Set to 0 to disable the timeout and wait indefinitely for component registration.

lib/react_on_rails/helper.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,9 @@ def stream_react_component(component_name, options = {})
172172
# config.enable_rsc_support = true
173173
# end
174174
#
175-
# @note The NDJSON stream format enables:
176-
# - Progressive streaming of RSC payloads as components finish rendering
177-
# - Real-time console log replay for debugging
178-
# - Error handling and reporting during rendering
179-
# - Selective hydration of client components
180-
# - Efficient code splitting and bundle loading
181-
#
182175
# @raise [ReactOnRailsPro::Error] if RSC support is not enabled in configuration
183176
#
184-
# Note: You don't have to deal directly with this helper function - it's used internally by the
177+
# @note You don't have to deal directly with this helper function - it's used internally by the
185178
# `rsc_payload_route` helper function. The returned data from this function is used internally by
186179
# components registered using the `registerServerComponent` function. Don't use it unless you need
187180
# more control over the RSC payload generation. To know more about RSC payload, see the following link:
@@ -256,7 +249,8 @@ def react_component_hash(component_name, options = {})
256249
# defer: false -- pass as true if you wish to render this below your component.
257250
# force_load: false -- pass as true if you wish to hydrate this store immediately instead of
258251
# waiting for the page to load.
259-
def redux_store(store_name, props: {}, defer: false, force_load: false)
252+
def redux_store(store_name, props: {}, defer: false, force_load: nil)
253+
force_load = ReactOnRails.configuration.force_load if force_load.nil?
260254
redux_store_data = { store_name: store_name,
261255
props: props,
262256
force_load: force_load }

0 commit comments

Comments
 (0)