Is there a canonical way to modify a local reducer behavior in TCA?

Hello!

Let say you have a local keyboard feature with two buttons A and B. The local reducer is such as tapping on A or B toggles respectively A or B states between on and off.
This local keyboard is then embedded in a global setup.

Let say that in the global framework, both A and B can't be on simultaneously and the expected behavior is that when B is on, tapping A doesn't toggle A on like the local reducer would do. How to combine the local reducer in the global reducer such as other actions from the local reducer are still live, but where the logic for tapping A or B is handled by the global reducer. I'm not looking for workarounds in this specific case (like disabling A when B is on). It is a more general issue I'm having with the way I should organize things in TCA.

In other words, is there a way to override some local reducer branches in a global reducer in the TCA spirit? Or is this issue is the sign of an ill-designed model to work with TCA?

I guess a workaround would be to fix the state a posteriori in the global realm, but what if the local reducer as an Effect when tapping A that I don't want to be sent if A is tapped when B is on?

Thanks!

I guess I'll parametrize the local reducer behavior from its environment.

1 Like
Terms of Service

Privacy Policy

Cookie Policy