-
-
Notifications
You must be signed in to change notification settings - Fork 251
It would be better if allSettled will return results of effect execution #385
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
Comments
This imply that allSettled might fail (because if you get results, you should get errors too), if this is an expected behavior, then we could implement that idea |
Oh, looks like errors support is a breaking change, as there are projects, which expect that allSettled is never throw an error |
I've thought again, and seems allSettled semantic really shouldn't return results/throw errors. Maybe like: const user = await getUserFx.withScope(scope)({ userId: 31 });
// or
const user = await scope.exec(getUserFx, { userId: 31 }); But in this case we're losing ability "Call provided event in scope and wait for finishing all the triggered effect." from |
Actually I think your variant is very good. Semantic is really good, no errors, but details. |
Okay, then we'll implement that in next minor release |
Updates: this feature was implemented in runtime and in typings, the last question is what this method should return when used with events? Is it ok to return After thinking about this for some time, I came to conclusion that calling |
Implemented in 21.4.0 |
@zerobias Thank you very much! 👍 |
Uh oh!
There was an error while loading. Please reload this page.
I'm trying to write SSR Isomorphic application (with Next.js) and I start using Fork api (scopes).
As I could understand (maybe wrong) I should use
allSettled
func when I use effects on backend-side.But If I wrap effects into
allSettled
I'm loosing my ability to read results of effect execution (returning values). And it very uncomfortable.I expected this flavour of using:
but
user
will beundefined
in this case...For contrast calling
const user = await getUserFx({ userId: 31 };
will return user data.Maybe in Effector exists another methods for call effects on the backend with specifying certain scope where I could get results of execution. I couldn't find.
The text was updated successfully, but these errors were encountered: