use_resource is the correct thing to use.
The top components can use_resource and be properly setup during hydration. The sub components need to use_server_resource so that they can be hydrated later.
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -297,7 +297,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bard"
|
name = "bard"
|
||||||
version = "0.3.10"
|
version = "0.3.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dioxus",
|
"dioxus",
|
||||||
"tavern",
|
"tavern",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bard"
|
name = "bard"
|
||||||
version = "0.3.10"
|
version = "0.3.11"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "Dioxus components that will display a Tavern blogging system Blog."
|
description = "Dioxus components that will display a Tavern blogging system Blog."
|
||||||
repository = "/CyberMages/tavern"
|
repository = "/CyberMages/tavern"
|
||||||
|
|||||||
@ -80,13 +80,13 @@ pub fn BlogList(tags: Signal<HashSet<String>>, children: Element) -> Element
|
|||||||
// Retrieve the provided settings from context.
|
// Retrieve the provided settings from context.
|
||||||
let settings = use_context::<BardSettings>();
|
let settings = use_context::<BardSettings>();
|
||||||
|
|
||||||
let list = use_server_future(move ||
|
let list = use_resource(move ||
|
||||||
{
|
{
|
||||||
let tags = tags();
|
let tags = tags();
|
||||||
let categories: Vec<String> = tags.iter().cloned().collect();
|
let categories: Vec<String> = tags.iter().cloned().collect();
|
||||||
|
|
||||||
async move { get_blog_list(categories).await }
|
async move { get_blog_list(categories).await }
|
||||||
})?;
|
});
|
||||||
|
|
||||||
rsx!
|
rsx!
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user