Effect CommunityEC
Effect Communityβ€’3y agoβ€’
23 replies
Thr1ve

Removing a Service from a Specific Effect

Is there any way to remove a service from a specific effect?

More context:

I have a withTransaction helper method that adds a Transaction service to effects within its scope. The database query/CRUD methods all use Effect.serviceOption to detect the presence of the Transaction service and act accordingly.

However, there are some cases where there are specific nested queries that should not be part of a transaction (in this case, gathering some extra metadata about the "action" in a forked thread which shouldn't be part of the transaction for the "action" itself).

Just like I can wrap an effect in withTransaction, I'd like to be able to wrap some effects further down the tree in some preventTransaction method that will remove the optional Transaction service if present.

I can think of other avenues to solve my immediate problem here, but I'm still curious: is removing an optional service like this something that's possible?
Was this page helpful?