watchers for async functions #791
Closed
brandon942
started this conversation in
General
Replies: 2 comments
-
That's a can of worms. First notice that const dep = ref(0);
// dep is a dependency of this effect
watchEffect(() => {
return fsync();
});
function fsync() {
return ref.value;
}
// dep is NOT a dependency of this effect, even though it's read inside fasync()
watchEffectAsync(resume => {
const result = await fasync();
resume();
return result;
});
async function fasync() {
await somePromise();
return ref.value;
} The work-around would be to propagate Then there are specs details to flesh out:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
implemented it myself. Userland solutions are preferred. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Crazy idea, right? Watchers for async functions, the big gap in the current reactive API.
tldr:
Beta Was this translation helpful? Give feedback.
All reactions