BlueHuskyStudios / BlueHuskyStudios/DeadassSimpleMediaPlayer
Duplicate Combine subscriptions accumulate across `onAppear`
- Dominant language
- Swift
- Stars
- 0
- Forks
- 3
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 9
Description
`onAppear` guards the periodic time observer with `if nil == periodicTimeObserverToken` — explicitly acknowledging that "`onAppear` can fire more than once." But the two `.sink` subscriptions in the same block (`player.publisher(for: \.rate)` and the interruption notification) have **no such guard** and are appended to `sinks` every time.
Each reappearance adds another rate observer and another interruption observer; nothing is ever removed, and `onDisappear` doesn't clear `sinks`. Duplicate rate handlers are mostly benign (idempotent assignment), but the set grows without bound and the interruption logging multiplies.
Contributor guide
Research direction
Start at the onAppear block containing the periodicTimeObserverToken guard and the two subscriptions added to sinks. Verify repeated appearances do not add duplicate rate or interruption observers, and confirm the existing observer behavior remains intact after the fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100