AnyInBounds discards the results of Update(). This makes it useless for value-based models, and doesn't let us use it to trigger tea.Cmds.
This PR adds AnyInBoundsAndUpdate (I'm not tied to the name); which doesn't discard the results of Update(), instead carrying updates to the model through the events, and returning the final tea.Model and resulting tea.Cmds.
I also refactored a bit to share the logic between these two functions, and changed said factored-out code to reduce allocations a bit.
๐งฐ Type of change
[x] New feature (non-breaking change which adds functionality).
๐ค Requirements
[x] โ I have read and agree to this projects Code of Conduct.
๐ Changes proposed by this PR
AnyInBounds
discards the results ofUpdate()
. This makes it useless for value-based models, and doesn't let us use it to triggertea.Cmd
s.This PR adds
AnyInBoundsAndUpdate
(I'm not tied to the name); which doesn't discard the results ofUpdate()
, instead carrying updates to the model through the events, and returning the finaltea.Model
and resultingtea.Cmd
s.I also refactored a bit to share the logic between these two functions, and changed said factored-out code to reduce allocations a bit.
๐งฐ Type of change
๐ค Requirements