You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
It looks like this issue has been fixed in the git version of dioxus after #3552. This code works with the git version of dioxus and the CLI. We also have a playwright test for this behavior now:
// [dependencies]// dioxus = { git = "https://github.com/DioxusLabs/dioxus", features = ["fullstack"] }// [features]// web = ["dioxus/web"]// server = ["dioxus/server"]#![allow(non_snake_case)]use dioxus::prelude::*;fnmain(){
dioxus::LaunchBuilder::new().with_context(1234u32).launch(app);}fnapp() -> Element{use_server_future(server_function)?;rsx!{"hello"}}#[server]asyncfnserver_function() -> Result<(),ServerFnError>{letFromContext(data):FromContext<u32> = extract().await.unwrap();assert_eq!(data,1234u32);println!("Server received: {}", data);Ok(())}
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.
On the server function try to grab the object manager
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:
Questionnaire
I'm interested in fixing this myself but don't know where to start
The text was updated successfully, but these errors were encountered: