浏览代码

Merge pull request #1235 from Demonthos/fix-use-future-looping

Fix use_future always spawning a new task and never updating
Jonathan Kelley 1 年之前
父节点
当前提交
b36a7a3993
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      packages/hooks/src/usefuture.rs

+ 6 - 0
packages/hooks/src/usefuture.rs

@@ -52,8 +52,14 @@ where
             val.set(Some(fut.await));
             task.take();
         })));
+
+        // Mark that we don't need to regenerate
+        state.needs_regen.set(false);
     }
 
+    // update the current value
+    state.state.current_val = val.current_val.clone();
+
     state
 }