dioxus-query icon indicating copy to clipboard operation
dioxus-query copied to clipboard

feat: Experimental dioxus fullstack support

Open marc2332 opened this issue 5 months ago • 6 comments

Based off https://github.com/marc2332/dioxus-query/pull/44 Closes https://github.com/marc2332/dioxus-query/issues/45

marc2332 avatar Jul 25 '25 22:07 marc2332

@marc2332 just had a go with this, but the use_server_query somehow never returns (just keeps blocking while page loading).

niclashoyer avatar Jul 26 '25 21:07 niclashoyer

@marc2332 just had a go with this, but the use_server_query somehow never returns (just keeps blocking while page loading).

So, in other words the suspense does not get "resolved" in the server side? Can you share how you call use_server_query?

marc2332 avatar Jul 26 '25 21:07 marc2332

I don't have a minimal example (yet), but I call it something like this:

#[component]
fn Foobar(id: ReadOnlySignal<Uuid>) -> Element {
    let foobar_query = use_server_query(Query::new(id(), GetFoobar())).suspend()?;
    // …
}

#[derive(Clone, PartialEq, Hash, Eq)]
struct GetFoobar();

impl QueryCapability for GetFoobar {
    type Ok = String;
    type Err = String;
    type Keys = Uuid;

    async fn run(&self, id: &Self::Keys) -> Result<Self::Ok, Self::Err> {
        let foobar = load_foobar(id).await; // this calls the server function

        Ok(foobar)
    }
}

niclashoyer avatar Jul 26 '25 21:07 niclashoyer

I don't have a minimal example (yet), but I call it something like this:

#[component]
fn Foobar(id: ReadOnlySignal<Uuid>) -> Element {
    let foobar_query = use_server_query(Query::new(id(), GetFoobar())).suspend()?;
    // …
}

#[derive(Clone, PartialEq, Hash, Eq)]
struct GetFoobar();

impl QueryCapability for GetFoobar {
    type Ok = String;
    type Err = String;
    type Keys = Uuid;

    async fn run(&self, id: &Self::Keys) -> Result<Self::Ok, Self::Err> {
        let foobar = load_foobar(id).await; // this calls the server function

        Ok(foobar)
    }
}

Can you try with the last commit I pushed?

marc2332 avatar Jul 26 '25 21:07 marc2332

@marc2332 behaviour did not change for ssr, it seems to not resolve at all. While I don't really need ssr, fullstack is just so convenient,

niclashoyer avatar Jul 26 '25 22:07 niclashoyer

id like to see server functions n hydration supported :(

Distortedlogic avatar Sep 17 '25 13:09 Distortedlogic