You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The progress bar, for the download, never gets updated, or when it does then it is quite erratic. I would say it's always below the real total of downloaded bytes.
When I debug this application, with delve, then I observe that the tag inside the progress.FrameMsg is (nearly) always below the (expected) tag inside the progress model. Since there is a line in the ProgressBar Update() function which checks if the msg's tag has the correct value, then a nil command is returned afterwards:
progress.go (line 209-215)
// If you're rendering with ViewAs you won't need this.
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case FrameMsg:
if msg.id != m.id || msg.tag != m.tag {
return m, nil
}
As a consequence the progress bar never gets updated (quasi never), since the resulting command is nil (nearly always).
Questions:
What I am doing wrong here? It looks like the messages are somehow "buffered" before being sent to the main application thread, thus the progress model tag is incremented too much before the first message has the opportunity to be processed. Is there some "buffering" issues?
Or ... Can it be a bug? May a fix could be the following?
// If you're rendering with ViewAs you won't need this.
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case FrameMsg:
if msg.id != m.id || (msg.tag <= m.lastProcessedTag && msg.tag > m.lastGeneratedTag) {
return m, nil
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
(Already poste on discord in the #Help channel, since no one answered I'm trying here)
Context:
I am trying to write an open source application which helps in downloading files from one machine to another on the same network/LAN.
You may find the current code source here: https://github.com/yifu/pushpop.
Problem:
The progress bar, for the download, never gets updated, or when it does then it is quite erratic. I would say it's always below the real total of downloaded bytes.
When I debug this application, with delve, then I observe that the tag inside the
progress.FrameMsgis (nearly) always below the (expected) tag inside the progress model. Since there is a line in the ProgressBarUpdate()function which checks if the msg's tag has the correct value, then a nil command is returned afterwards:progress.go (line 209-215)
As a consequence the progress bar never gets updated (quasi never), since the resulting command is nil (nearly always).
Questions:
What I am doing wrong here? It looks like the messages are somehow "buffered" before being sent to the main application thread, thus the progress model tag is incremented too much before the first message has the opportunity to be processed. Is there some "buffering" issues?
Or ... Can it be a bug? May a fix could be the following?
Beta Was this translation helpful? Give feedback.
All reactions