New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add plain value support to task #220
Conversation
That sounds reasonable to me - shouldn't a test be added? |
I enhanced one of the existing tests to show that it works |
wow, I was about to file this as an issue. I was super hyped and changed all of my flow to actionAsync but for actions that do not return a promise (e.g. await is only called in one branch of an if/else) error would be thrown. Hope this address that issue. Could you guys create a minor release for this? @urugator @mweststrate Also, great work @xaviergonz. Thank you so much! |
@blacksteed232 was the error you were getting about task not supporting a non promise or something else? |
@xaviergonz I have a function like this @actionAsync
async doSomething(): Promise<void> {
if (this.canDoIt()) {
await task(/* some promise */);
}
} Funny thing is when I call this function once it’s fine but if I call it twice or 2 functions that look like this, it would throw
Now if instead, I call task(doSomething())
task(doSomething()) It would be okay, but that's obviously not what we want, we want to use Also if I modify my doSomething to @actionAsync
async doSomething(): Promise<void> {
if (this.canDoIt()) {
await task(/* some promise */);
} else {
await task(/* some other promise */);
}
} It will work. So I look at your change and at least the title of this PR and I thought that’s it, we can wait for value as well. Am I right here, or my issue is completely unrelated? Sorry if my markdown is screwed up, im at work so typing this from a phone :) |
@blacksteed232 that should be fixed by this other PR #221 |
Ah gotcha! Thank you! Are you happen to be a maintainer or know when could these changes go out in a release @xaviergonz? |
Like the name, make task support plain values (like await does)