Repository navigation
[tech-debt 2/5 medium-low risk] Fix leaked listeners and unhandled rejections - #14775
Merged
Merged
Conversation
Contained fixes from #14665 with no intended UX change: - harmony Modal: remove the touchmove listener on close/unmount - harmony Slider: detach document drag listeners on unmount - mobile GoogleCast: remove the PlaybackActiveTrackChanged listener - mobile Airplay: call remove() on the subscription (stop() doesn't exist) - mobile useRevertOnCancel: return the unsubscribe from addListener - mobile audius-sdk: init waiters use once() - mobile ChatScreen: add deps so the AppState listener isn't re-added each render - web StripeOnRampModal: remove onramp_session_updated listener; catch init failure - web foregroundPollingDaemon: remove visibilitychange listener on cancel - common uuid(): variant digit came from a string bitwise op Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second of five PRs that re-ship #14665 on current main, ordered from lowest to highest risk. Branched off main, independent of the others.
What's in it
Listener leaks and unhandled rejections. None of these are meant to change what the user sees.
harmony
Modal: thetouchmovelistener on the modal root was only removed on the next close render, so it leaked on unmount and stacked whenonTouchMoveormodalRootchanged. It's now removed in the effect cleanup.Slider: document mouse/touch listeners leaked when it unmounted mid-drag. They're removed on unmount.mobile
GoogleCast: thePlaybackActiveTrackChangedlistener was never removed, so it piled up on each reconnect or track change and kept calling stale cast clients. Moved fromuseAsynctouseEffectwith a cleanup, and load errors are logged.Airplay: cleanup called.stop(), which doesn't exist on the subscription, so the listener was never removed. It now calls.remove().useRevertOnCancel:navigation.addListenerreturns an unsubscribe function, and passing that toremoveListenerdid nothing. The effect now returns the unsubscribe.audius-sdk: each concurrent init waiter added a permanent listener. It usesonce().ChatScreen: the AppState listener effect had no deps array, so it was removed and re-added on every render.web
StripeOnRampModal: theonramp_session_updatedlistener is removed on cleanup (it stacked on each reopen with the same session), and a failed session init is caught and logged.foregroundPollingDaemon: thevisibilitychangelistener is removed when the saga is cancelled.common
uuid(): the variant digit came from'a' & 0x3, which isNaN & 3, so hex letters always became8. It now parses the digit first. Output format is unchanged. This was in tier 3 in the plan; I moved it here because it only changes the random distribution of one character.Why this tier
Each fix is local to one component or helper and only touches cleanup paths or error handling.
Verified
tsc: harmony clean. common, mobile and web show the same errors as origin/main in this checkout, all in untouched files.eslinton changed files: clean.store/upload/selectors.test.tsfailure only).Not verified
Not run on a device or in a browser. Chromecast, AirPlay and the Stripe onramp in particular were not exercised.
🤖 Generated with Claude Code