From 44e5cad241a89101669482aea5e364cbca38ebe8 Mon Sep 17 00:00:00 2001 From: Henry <56412856+mcmah309@users.noreply.github.com> Date: Sat, 16 Aug 2025 03:28:59 +0700 Subject: [PATCH] Improve use_server_cached docs (#4557) --- packages/fullstack-hooks/src/hooks/server_cached.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/fullstack-hooks/src/hooks/server_cached.rs b/packages/fullstack-hooks/src/hooks/server_cached.rs index dad43a0e9..fdf394c02 100644 --- a/packages/fullstack-hooks/src/hooks/server_cached.rs +++ b/packages/fullstack-hooks/src/hooks/server_cached.rs @@ -2,9 +2,12 @@ use dioxus_core::use_hook; use dioxus_fullstack_protocol::SerializeContextEntry; use serde::{de::DeserializeOwned, Serialize}; -/// This allows you to send data from the server to the client. The data is serialized into the HTML on the server and hydrated on the client. +/// This allows you to send data from the server to the client *during hydration*. +/// - When compiled as server, the closure is ran and the resulting data is serialized on the server and sent to the client. +/// - When compiled as web client, the data is deserialized from the server if already available, otherwise runs on the client. Data is usually only available if this hook exists in a component during hydration. +/// - When otherwise compiled, the closure is run directly with no serialization. /// -/// When you run this function on the client, you need to be careful to insure the order you run it initially is the same order you run it on the server. +/// The order this function is run on the client needs to be the same order initially run on the server. /// /// If Dioxus fullstack cannot find the data on the client, it will run the closure again to get the data. ///