Fix fullstack render server context (#2139)
* Fix fullstack render server context * only set the server context while polling futures --------- Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
1 parent
e464294c66
commit
fb396b0448
3 files changed
+26
-35
No files matched your search
@@ -60,8 +60,6 @@ use axum::{
|
||||
extract::State,
|
||||
http::{Request, Response, StatusCode},
|
||||
response::IntoResponse,
|
||||
routing::{get, post},
|
||||
Router,
|
||||
};
|
||||
use dioxus_lib::prelude::VirtualDom;
|
||||
use futures_util::Future;
|
||||
@@ -69,9 +67,7 @@ use http::header::*;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{
|
||||
prelude::*, render::SSRState, serve_config::ServeConfig, server_context::DioxusServerContext,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
|
||||
/// A extension trait with utilities for integrating Dioxus with your Axum router.
|
||||
pub trait DioxusRouterExt<S> {
|
||||
@@ -508,8 +504,8 @@ async fn handle_server_fns_inner(
|
||||
.unwrap_or(false);
|
||||
let referrer = req.headers().get(REFERER).cloned();
|
||||
|
||||
// actually run the server fn
|
||||
let mut res = service.run(req).await;
|
||||
// actually run the server fn (which may use the server context)
|
||||
let mut res = ProvideServerContext::new(service.run(req), server_context.clone()).await;
|
||||
|
||||
// it it accepts text/html (i.e., is a plain form post) and doesn't already have a
|
||||
// Location set, then redirect to Referer
|
||||
|
||||
Reference in new issue
Block a user