You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The submitPassowrdFx should be called once submitPasswordEvent is fired, but only when AuthFlowState is in the right state
Then we need to collect username from AuthFlowState and password from submitPasswordEvent params in order to call a submitPassowrdFx effect.
The code snipper above won't compile, due to types mismatch, because we also need to pass password from clock. If we would have a mapping function (like fn in sample), which would be called after filtering, we could easily shape a params expected by target effect
Workaround
We can achieve desired behaviour by combining sample with guard as follows:
The reason why fn is still missing in guard is purely technical - it is quite difficult to write types for guard, so we have not yet succeeded in implementing this feature
Proposal
Provide an ability to transform data from
clock
andsource
inguard
function.Use case
Suppose we have a simple authentication flow, with following definitions
submitPassowrdFx
should be called oncesubmitPasswordEvent
is fired, but only whenAuthFlowState
is in the right stateAuthFlowState
and password fromsubmitPasswordEvent
params in order to call asubmitPassowrdFx
effect.The code snipper above won't compile, due to types mismatch, because we also need to pass password from clock. If we would have a mapping function (like
fn
insample
), which would be called after filtering, we could easily shape a params expected by target effectWorkaround
We can achieve desired behaviour by combining sample with guard as follows:
The text was updated successfully, but these errors were encountered: