summaryrefslogtreecommitdiff
path: root/internal/switcher
diff options
context:
space:
mode:
Diffstat (limited to 'internal/switcher')
-rw-r--r--internal/switcher/switcher.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/internal/switcher/switcher.go b/internal/switcher/switcher.go
index ec5c47a..860bf81 100644
--- a/internal/switcher/switcher.go
+++ b/internal/switcher/switcher.go
@@ -66,12 +66,10 @@ func (m *Model) NewNotice(msg string) tea.Cmd {
func (m Model) Init() tea.Cmd {
cmds := []tea.Cmd{}
- // Make a backup of notices received before the program starts
- // then reinitialize them with a proper expiration time.
- noticeBackup := m.notices.Notices
- m.notices = notices.New()
- for _, v := range noticeBackup {
- cmds = append(cmds, m.NewNotice(v))
+ // The NoticeExpiryMsg is never sent to bubbletea by a tea.Cmd for the initial notices
+ // That's why we need to manually reset them here. Otherwise, they would never expire.
+ for k := range m.notices.Notices {
+ cmds = append(cmds, m.notices.Reset(k))
}
for _, p := range m.pickers {