瀏覽代碼

fix dioxus web

Evan Almloff 1 年之前
父節點
當前提交
205a005142
共有 3 個文件被更改,包括 7 次插入14 次删除
  1. 3 3
      packages/signals/src/signal.rs
  2. 3 7
      packages/web/src/lib.rs
  3. 1 4
      packages/web/src/platform.rs

+ 3 - 3
packages/signals/src/signal.rs

@@ -473,7 +473,7 @@ impl<T: Copy, S: Storage<SignalData<T>> + 'static> Deref for Signal<T, S> {
         // First we create a closure that captures something with the Same in memory layout as Self (MaybeUninit<Self>).
         let uninit_callable = MaybeUninit::<Self>::uninit();
         // Then move that value into the closure. We assume that the closure now has a in memory layout of Self.
-        let uninit_closure = move || Self::read(unsafe { &*uninit_callable.as_ptr() }).clone();
+        let uninit_closure = move || *Self::read(unsafe { &*uninit_callable.as_ptr() });
 
         // Check that the size of the closure is the same as the size of Self in case the compiler changed the layout of the closure.
         let size_of_closure = std::mem::size_of_val(&uninit_closure);
@@ -510,7 +510,7 @@ impl<T: 'static, S: Storage<SignalData<T>>> Drop for SignalSubscriberDrop<T, S>
 /// A mutable reference to a signal's value.
 ///
 /// T is the current type of the write
-/// B is the dynamicly checked type of the write (RefMut)
+/// B is the dynamically checked type of the write (RefMut)
 /// S is the storage type of the signal
 /// I is the type of the original signal
 pub struct Write<T: 'static, B: MappableMut<T>, S: Storage<SignalData<I>>, I: 'static = T> {
@@ -640,7 +640,7 @@ impl<T: Copy, S: Storage<SignalData<T>> + 'static> Deref for ReadOnlySignal<T, S
         // First we create a closure that captures something with the Same in memory layout as Self (MaybeUninit<Self>).
         let uninit_callable = MaybeUninit::<Self>::uninit();
         // Then move that value into the closure. We assume that the closure now has a in memory layout of Self.
-        let uninit_closure = move || Self::read(unsafe { &*uninit_callable.as_ptr() }).clone();
+        let uninit_closure = move || *Self::read(unsafe { &*uninit_callable.as_ptr() });
 
         // Check that the size of the closure is the same as the size of Self in case the compiler changed the layout of the closure.
         let size_of_closure = std::mem::size_of_val(&uninit_closure);

+ 3 - 7
packages/web/src/lib.rs

@@ -60,7 +60,7 @@ use std::rc::Rc;
 pub use crate::cfg::Config;
 #[cfg(feature = "file_engine")]
 pub use crate::file_engine::WebFileEngineExt;
-use dioxus_core::{ComponentFunction, CrossPlatformConfig, VirtualDom};
+use dioxus_core::CrossPlatformConfig;
 use futures_util::{
     future::{select, Either},
     pin_mut, FutureExt, StreamExt,
@@ -99,12 +99,8 @@ mod rehydrate;
 ///     wasm_bindgen_futures::spawn_local(app_fut);
 /// }
 /// ```
-pub async fn run_with_props<
-    Component: ComponentFunction<Phantom, Props = Props>,
-    Props: Clone + 'static,
-    Phantom: 'static,
->(
-    dioxus_config: CrossPlatformConfig<Component, Props, Phantom>,
+pub async fn run_with_props<Props: Clone + 'static>(
+    dioxus_config: CrossPlatformConfig<Props>,
     web_config: Config,
 ) {
     tracing::info!("Starting up");

+ 1 - 4
packages/web/src/platform.rs

@@ -8,10 +8,7 @@ pub struct WebPlatform;
 impl<Props: Clone + 'static> PlatformBuilder<Props> for WebPlatform {
     type Config = Config;
 
-    fn launch<Component: ComponentFunction<Phantom, Props = Props>, Phantom: 'static>(
-        config: CrossPlatformConfig<Component, Props, Phantom>,
-        platform_config: Self::Config,
-    ) {
+    fn launch(config: CrossPlatformConfig<Props>, platform_config: Self::Config) {
         wasm_bindgen_futures::spawn_local(async move {
             crate::run_with_props(config, platform_config).await;
         });