https://kotlinlang.org logo
#ballast
Title
# ballast
r

rocketraman

06/06/2022, 8:40 PM
Is there a way to post an event to a view model without having an InputHandlerScope?
c

Casey Brooks

06/06/2022, 9:04 PM
No, and this is intentional. In keeping with the purity of the MVI model, the only thing that goes into the ViewModel is an Input, and being able to just post Events directly from the UI or somewhere else really muddies up the distinction between Inputs and Events.
r

rocketraman

06/06/2022, 9:47 PM
So if I have an external event (like the result of an auth popup that I don't control) the right way to do that is to model that as an Input?
It makes sense.. its an input into the state system, even if its not user-driven.
c

Casey Brooks

06/06/2022, 10:12 PM
Yes, that’s correct, anything that goes into the VM must be modeled as an Input, and it’s not limited to user-initiated things. It’s helpful to consider the user’s actions when defining the Contract, but there’s nothing wrong with adding Inputs for other things as well
👍 1
6 Views