In the scala
and scalajs
library Diode
, I have used but not entirely understood the PotAction
class and only recently discovered the AsyncAction
class, both of which seem to be favored in situations involving, well, asynchronous requests. While I understand that, I don't entirely understand the design decisions and the naming choices, which seem to suggest a more narrow use case.
Specifically, both AsyncAction
and PotAction
require an initialModel
and a next
, as though both are modeling an asynchronous request for some kind of refreshable, updateable content rather than a command in the sense of CQRS. I have a somewhat-related question open regarding synchronous actions on form inputs by the way.
I have a few specific use cases in mind. I'd like to know a sketch (not asking for implementation, just the concept) of how you use something like PotAction
in conjunction with any of:
- Username/password authentication in a conventional flow
- OpenAuth-style authentication with a third-party involved and a redirect
- Token or cookie authentication behind the scenes
- Server-side validation of form inputs
- Submission of a command for a remote shell
All of these seem to be a bit different in nature to what I've seen using PotAction
but I really want to use it because it has already been helpful when I am, say, rendering something based on the current state of the Pot
.