Fixing regression due to route preservation #4934 (#4980)

This commit is contained in:
RichardWGNR authored and GitHub committed 2025-11-24 16:48:42 -08:00
1 parent 702fbac2da
commit 488ad0b9c9
1 file changed
+1 -18
+1 -18
View File
@@ -7,8 +7,7 @@ use crate::{
shortcut::ShortcutRegistry,
webview::{PendingWebview, WebviewInstance},
};
use dioxus_core::{consume_context, ScopeId, VirtualDom};
use dioxus_history::History;
use dioxus_core::VirtualDom;
use std::{
cell::{Cell, RefCell},
collections::HashMap,
@@ -480,9 +479,6 @@ impl App {
#[cfg(debug_assertions)]
fn persist_window_state(&self) {
use dioxus_core::ScopeId;
use dioxus_history::History;
if let Some(webview) = self.webviews.values().next() {
let window = &webview.desktop_context.window;
@@ -518,17 +514,12 @@ impl App {
return;
};
let url = webview.dom.in_scope(ScopeId::ROOT, || {
consume_context::<Rc<dyn History>>().current_route()
});
let state = PreservedWindowState {
x,
y,
width: width.max(200),
height: height.max(200),
monitor: monitor_name.to_string(),
url: Some(url),
};
// Yes... I know... we're loading a file that might not be ours... but it's a debug feature
@@ -582,13 +573,6 @@ impl App {
window.set_inner_size(tao::dpi::PhysicalSize::new(size.0, size.1));
}
}
// Set the url if it exists
webview.dom.in_scope(ScopeId::ROOT, || {
if let Some(url) = state.url {
consume_context::<Rc<dyn History>>().replace(url);
}
})
}
}
}
@@ -627,7 +611,6 @@ struct PreservedWindowState {
width: u32,
height: u32,
monitor: String,
url: Option<String>,
}
/// Return the location of a tempfile with our window state in it such that we can restore it later