forked from Mirrors/bubbletea
Stop old subscription when it becomes reassigned as nil
This commit is contained in:
parent
2e509ad32c
commit
cd63ed1e44
6
tea.go
6
tea.go
|
@ -269,10 +269,12 @@ func (p *Program) processSubs(msgs chan Msg, activeSubs subManager) subManager {
|
|||
return activeSubs
|
||||
}
|
||||
|
||||
// Stop subscriptions that don't exist in the new subscription map
|
||||
// Stop subscriptions that don't exist in the new subscription map and
|
||||
// stop subscriptions where the new subscription is mapped to a nil.
|
||||
if len(activeSubs) > 0 {
|
||||
for key, sub := range activeSubs {
|
||||
if _, exists := newSubs[key]; !exists {
|
||||
_, exists := newSubs[key]
|
||||
if !exists || exists && newSubs[key] == nil {
|
||||
close(sub.done)
|
||||
delete(activeSubs, key)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue