Fix the current route in ssr fullstack rendering (#3153)
This commit is contained in:
1 parent
caa9759e44
commit
412f0b5c44
3 files changed
+191
-2
No files matched your search
@@ -65,6 +65,7 @@ dioxus-cli-config = { workspace = true, optional = true }
|
||||
|
||||
dioxus-devtools = { workspace = true, optional = true }
|
||||
aws-lc-rs = { version = "1.8.1", optional = true }
|
||||
dioxus-history.workspace = true
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
tokio = { workspace = true, features = ["rt", "sync"], optional = true }
|
||||
|
||||
@@ -7,6 +7,7 @@ use dioxus_lib::document::Document;
|
||||
use dioxus_ssr::Renderer;
|
||||
use futures_channel::mpsc::Sender;
|
||||
use futures_util::{Stream, StreamExt};
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::sync::RwLock;
|
||||
use std::{collections::HashMap, future::Future};
|
||||
@@ -168,6 +169,9 @@ impl SsrRendererPool {
|
||||
let mut virtual_dom = virtual_dom_factory();
|
||||
let document = std::rc::Rc::new(crate::document::server::ServerDocument::default());
|
||||
virtual_dom.provide_root_context(document.clone());
|
||||
virtual_dom.provide_root_context(Rc::new(
|
||||
dioxus_history::MemoryHistory::with_initial_path(&route),
|
||||
) as Rc<dyn dioxus_history::History>);
|
||||
virtual_dom.provide_root_context(document.clone() as std::rc::Rc<dyn Document>);
|
||||
|
||||
// poll the future, which may call server_context()
|
||||
|
||||
Reference in new issue
Block a user