From f6acaba061edbd517f3dbdba8d542443e032ef9f Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Thu, 4 Jan 2024 17:04:56 -0600 Subject: [PATCH] fix compilation --- packages/core/src/error_boundary.rs | 8 +- packages/desktop/Cargo.toml | 3 +- packages/desktop/src/desktop_context.rs | 3 +- packages/desktop/src/lib.rs | 7 +- packages/desktop/src/protocol.rs | 15 ++- packages/desktop/src/shortcut.rs | 5 +- packages/desktop/src/webview.rs | 164 ++++++++++++------------ packages/rsx-rosetta/src/lib.rs | 20 +-- 8 files changed, 113 insertions(+), 112 deletions(-) diff --git a/packages/core/src/error_boundary.rs b/packages/core/src/error_boundary.rs index 2f64bea9f..d42f59395 100644 --- a/packages/core/src/error_boundary.rs +++ b/packages/core/src/error_boundary.rs @@ -286,7 +286,8 @@ fn default_handler<'a>(error: CapturedError) -> LazyNodes<'a, 'a> { attr_paths: &[], }; VNode { - parent: None, + parent: Default::default(), + stable_id: Default::default(), key: None, template: std::cell::Cell::new(TEMPLATE), root_ids: bumpalo::collections::Vec::with_capacity_in(1usize, __cx.bump()).into(), @@ -471,12 +472,13 @@ pub fn ErrorBoundary<'a>(cx: Scope<'a, ErrorBoundaryProps<'a>>) -> Element { attr_paths: &[], }; VNode { - parent: None, + parent: Default::default(), + stable_id: Default::default(), key: None, template: std::cell::Cell::new(TEMPLATE), root_ids: bumpalo::collections::Vec::with_capacity_in(1usize, __cx.bump()).into(), dynamic_nodes: __cx.bump().alloc([{ - let ___nodes = (&cx.props.children).into_vnode(__cx); + let ___nodes = (&cx.props.children).into_dyn_node(__cx); ___nodes }]), dynamic_attrs: __cx.bump().alloc([]), diff --git a/packages/desktop/Cargo.toml b/packages/desktop/Cargo.toml index 3d8c2d31b..1064d2c1e 100644 --- a/packages/desktop/Cargo.toml +++ b/packages/desktop/Cargo.toml @@ -59,13 +59,12 @@ tokio_runtime = ["tokio"] fullscreen = ["wry/fullscreen"] transparent = ["wry/transparent"] devtools = ["wry/devtools"] -dox = ["wry/dox"] hot-reload = ["dioxus-hot-reload"] gnu = [] [package.metadata.docs.rs] default-features = false -features = [ "dox", "tokio_runtime", "hot-reload" ] +features = ["tokio_runtime", "hot-reload"] [dev-dependencies] dioxus-core-macro = { workspace = true } diff --git a/packages/desktop/src/desktop_context.rs b/packages/desktop/src/desktop_context.rs index 79c943851..62a574d9b 100644 --- a/packages/desktop/src/desktop_context.rs +++ b/packages/desktop/src/desktop_context.rs @@ -466,9 +466,8 @@ pub fn use_wry_event_handler( cx: &ScopeState, handler: impl FnMut(&Event, &EventLoopWindowTarget) + 'static, ) -> &WryEventHandler { - let desktop = use_window(cx); cx.use_hook(move || { - let desktop = desktop.clone(); + let desktop = window(); let id = desktop.create_wry_event_handler(handler); diff --git a/packages/desktop/src/lib.rs b/packages/desktop/src/lib.rs index 63f030b3f..9460ca87d 100644 --- a/packages/desktop/src/lib.rs +++ b/packages/desktop/src/lib.rs @@ -22,6 +22,7 @@ use crate::query::QueryResult; use crate::shortcut::GlobalHotKeyEvent; pub use cfg::{Config, WindowCloseBehaviour}; pub use desktop_context::DesktopContext; +#[allow(deprecated)] pub use desktop_context::{ use_window, use_wry_event_handler, window, DesktopService, WryEventHandler, WryEventHandlerId, }; @@ -33,8 +34,8 @@ use dioxus_interpreter_js::binary_protocol::Channel; use element::DesktopElement; use eval::init_eval; use futures_util::{pin_mut, FutureExt}; -use rustc_hash::FxHashMap; pub use protocol::{use_asset_handler, AssetFuture, AssetHandler, AssetRequest, AssetResponse}; +use rustc_hash::FxHashMap; use shortcut::ShortcutRegistry; pub use shortcut::{use_global_shortcut, ShortcutHandle, ShortcutId, ShortcutRegistryError}; use std::cell::Cell; @@ -49,7 +50,7 @@ use tao::{ event::{Event, StartCause, WindowEvent}, event_loop::ControlFlow, }; -pub use webview::build_default_menu_bar; +// pub use webview::build_default_menu_bar; pub use wry; pub use wry::application as tao; use wry::application::event_loop::EventLoopBuilder; @@ -412,8 +413,8 @@ fn create_new_window( queue.clone(), event_handlers.clone(), shortcut_manager, - asset_handlers, edit_queue, + asset_handlers, )); let cx = dom.base_scope(); diff --git a/packages/desktop/src/protocol.rs b/packages/desktop/src/protocol.rs index f00221d85..61c6af661 100644 --- a/packages/desktop/src/protocol.rs +++ b/packages/desktop/src/protocol.rs @@ -1,5 +1,6 @@ +use crate::{window, DesktopContext}; use dioxus_core::ScopeState; -use dioxus_interpreter_js::{COMMON_JS, INTERPRETER_JS}; +use dioxus_interpreter_js::INTERPRETER_JS; use slab::Slab; use std::{ borrow::Cow, @@ -16,10 +17,8 @@ use tokio::{ }; use wry::{ http::{status::StatusCode, Request, Response}, - webview::RequestAsyncResponder, Result, }; -use crate::{use_window, DesktopContext}; use crate::desktop_context::EditQueue; @@ -52,7 +51,7 @@ fn module_loader(root_name: &str, headless: bool) -> String { } }"#, ); - + format!( r#"