Skip to content

Fullstack app on 0.6 with context fails to share the state on server functions #3064

@fabiodcorreia

Description

@fabiodcorreia

Problem

Shared context on server server functions doesn't work on alpha.3 but was working fine on alpha.2. On 3 when I try to grab the state from the context I get ServerError|"alloc::sync::Arc<browser::BrowserManager>" not found in server context.

I also tried with other types like an empty struct Pool as described on the examples but the result is the same.

Steps To Reproduce

Steps to reproduce the behavior:

Create a fullstack app with context and without router.

LaunchBuilder::new()
        .with_context(server_only! {browser::BrowserManager::new()}) //The method new returns an Arc
        .launch(App);

On the server function try to grab the object manager

let FromContext(manager): FromContext<Arc<browser::BrowserManager>> = extract().await?;

When the server function is invoked from the frontend the error above described happens.

Expected behavior

Expected the state to be accessible on the server function.

Screenshots

Environment:

  • Dioxus version: v0.6.0-alpha.3
  • Rust version: 1.81
  • OS info: MacOS Intel
  • App platform: Fullstack

Questionnaire

I'm interested in fixing this myself but don't know where to start

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions