Replies: 3 comments 2 replies
-
I'm also a bit new to Bubble Tea and The Elm Architecture but I'll give this a shot.
This is because even though it might feel like you mutate your Model during
Batching Cmds is common, but I wouldn't quite go so far as to say it pretty much always happens. Cmds are generally used to perform async operations like I/O and API calls as side-effects, but oftentimes you don't need to do any of those things in which case you can just return a
One thing to note here is that just because you have a submodel like So, depending what needs to happen in
Hope that helps. |
Beta Was this translation helpful? Give feedback.
-
Wow, much appreciate taking the time to answer, @seanbanko.
That's a nice summary.
Right. But why not return a pointer to a Much appreciate you taking the time answer. |
Beta Was this translation helpful? Give feedback.
-
Hi! We took this design approach based on our positive experiences with Elm's implementation of the Elm architecture, despite your very valid point about how it hides functionality like Specifically, we found the single return tea.Sequence(doThis, thenThis, andThenThis) This lets you do things like the following: return someCmd
return tea.Batch(someCmds...)
return tea.Sequentially(thisCmd, thatCmd)
return tea.Batch(
tea.Sequentially(someCmds...),
tea.Sequentially(otherCmds...),
anotherCmd,
) And in all of the above cases we're still returning just a single |
Beta Was this translation helpful? Give feedback.
-
I am a little confused on the function signatures of
Init
andUpdate
.It seems like there will pretty much always be more than a single
Cmd
and it will always have to be wrapped in aBatch
. Is this "normal" API flow?And why does the model have to be passed through during
Update
?Why not just return
Cmd
s?Beta Was this translation helpful? Give feedback.
All reactions