Merged
Conversation
Signed-off-by: Bence Vidosits <bence.vidosits1@ibm.com>
Contributor
Author
|
I've tried to reproduce this using the example in bubbletea but couldn't, which is interesting. My setup was very simple, like this: I guess my source is now officially "trust me bro", I do hope though that based on the official |
Contributor
|
ah, I can see that happening indeed. good catch! |
caarlos0
approved these changes
Jan 22, 2025
Contributor
|
Thanks @bevicted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
stopwatch currently has a non deterministic way of starting. This is easily fixed by using
tea.Sequenceinstead oftea.Batch.timer is not affected as it doesn't use batch on
Start()Bug
Relevant code parts from stopwatch's file:
Batch's description:
So what basically happens is sometimes
TickMsgarrives beforeStartStopMsg, asrunningis stillfalsethis is thrown away.After that the
StartStopMsgfinally comes in and switchesrunningtotrue, however as theTickMsgis already thrown away, nothing happens (except messing up someone's code who usesToggle())Workaround
As a temp workaround, because I (annoyingly) can't set
StartStopMsg.runningto true,BatchMsg's type is[]tea.Cmd, so I unpacked it into aSequence.Contrib notes
Steps to reproduce are... well basically just use the package, calling
StartandStop/reinit model. Way I figured out what happens is set a UI texts toRunning()and whetherTickMsgwas received or not.