소스 검색

only give out a ReadOnlySignal from async resources

Evan Almloff 1 년 전
부모
커밋
38bdab880d
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      packages/hooks/src/use_resource.rs

+ 2 - 2
packages/hooks/src/use_resource.rs

@@ -95,8 +95,8 @@ impl<T> AsyncMemo<T> {
     /// Return any value, even old values if the future has not yet resolved.
     ///
     /// If the future has never completed, the returned value will be `None`.
-    pub fn value(&self) -> Option<Signal<T>> {
-        self.value.cloned()
+    pub fn value(&self) -> Option<ReadOnlySignal<T>> {
+        self.value.cloned().map(|sig| sig.into())
     }
 
     /// Get the ID of the future in Dioxus' internal scheduler