Effect CommunityEC
Effect Community10mo ago
6 replies
jvliwanag

Handling Mutations with `effect-rx` and Avoiding Unwanted Re-executions

on effect-rx -- Using Rx.fn for mutations is a bit troublesome -- if I get or ctx.result one of the values of an rx, I end up subscribing to it. And if that subscribed value changes, then the Effect which happen to be a mutation gets ran again.

I can use once, but that means I can't use initially unmountd Rx<Result<...>> . I guess a workaround can be i can call
self
to check if the Rx.fn has succeded before and return early if it does. But then i'd need to reset it Rx.fn if i want to use it again.

Wondering what you guys use instead for mutations?
Was this page helpful?