Skip to content

Commit 1fd8a10

Browse files
committed
Intialize index before starting progress bar
1 parent cfed52e commit 1fd8a10

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

ui/s3hub/delete.go

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ func (m *s3hubDeleteBucketModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
133133
}
134134
m.sum = len(m.targetBuckets) + 1
135135
m.status = statusBucketDeleting
136+
m.index = 0 // Initialize index to 0 to accurately represent the starting state of progress.
136137
progressCmd := m.progress.SetPercent(float64(m.index) / float64(m.sum-1))
137138

138139
return m, tea.Batch(

ui/s3hub/list.go

+4
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ func (m *s3hubListBucketModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
125125
}
126126
m.sum = len(m.targetBuckets) + 1
127127
m.status = statusDownloading
128+
m.index = 0 // Initialize index to 0 to accurately represent the starting state of progress.
128129
progressCmd := m.progress.SetPercent(float64(m.index) / float64(m.sum-1))
129130

130131
return m, tea.Batch(
@@ -141,6 +142,7 @@ func (m *s3hubListBucketModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
141142
}
142143
m.sum = len(m.targetBuckets) + 1
143144
m.status = statusBucketDeleting
145+
m.index = 0 // Initialize index to 0 to accurately represent the starting state of progress.
144146
progressCmd := m.progress.SetPercent(float64(m.index) / float64(m.sum-1))
145147

146148
return m, tea.Batch(m.spinner.Tick,
@@ -443,6 +445,7 @@ func (m *s3hubListS3ObjectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
443445
}
444446
m.sum = len(m.targetS3Keys) + 1
445447
m.status = statusDownloading
448+
m.index = 0 // Initialize index to 0 to accurately represent the starting state of progress.
446449

447450
progressCmd := m.progress.SetPercent(float64(m.index) / float64(m.sum-1))
448451
return m, tea.Batch(m.spinner.Tick,
@@ -458,6 +461,7 @@ func (m *s3hubListS3ObjectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
458461
}
459462
m.sum = len(m.targetS3Keys) + 1
460463
m.status = statusS3ObjectDeleting
464+
m.index = 0 // Initialize index to 0 to accurately represent the starting state of progress.
461465

462466
progressCmd := m.progress.SetPercent(float64(m.index) / float64(m.sum-1))
463467
return m, tea.Batch(m.spinner.Tick,

0 commit comments

Comments
 (0)