Repository navigation
Fix playlist Crop throwing instead of removing unselected tracks - #1388
Merged
Merged
Conversation
2dee12e stored the playlist selection as an array rather than a Set, but cropPlaylist still called .has() on it. A @ts-ignore on that line hid the type error, so Crop has thrown "selectedTrackIds.has is not a function" since 2.2.0. Use the Set selector and drop the stale @ts-ignore. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for tourmaline-kringle-c98715 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: +2 B (0%) Total Size: 491 kB 📦 View Changed
|
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.
"Crop" in the playlist's Remove menu throws instead of removing the unselected tracks, and has since 2.2.0. In Sentry this is WEBAMP-1PQ (
TypeError: n.has is not a function), 880 events since September 2025 and still arriving daily.2dee12e ("Avoid non-serializable object in Redux store") changed
state.playlist.selectedTracksfrom aSetto an array and addedgetSelectedTrackIdsSetfor callers that need.has().cropPlayliststill usedgetSelectedTrackIdsand called.has()on the array. A// @ts-ignoreon that line, left over from an older number-keys workaround, hid the type error.This switches
cropPlaylisttogetSelectedTrackIdsSetand removes the@ts-ignore, which is no longer needed now thattrackOrderisnumber[].cropPlaylistwas the only remaining caller that treated the selection as aSet.Steps to reproduce (on webamp.org today)
TypeError: n.has is not a function.Test plan
js/actionCreators/playlist.test.ts: with tracks 1, 2 and 3 and track 2 selected,cropPlaylist()dispatchesREMOVE_TRACKSwith ids[1, 3]; with no selection it dispatches nothing. Before the fix the first test fails withselectedTrackIds.has is not a function, the same error as production.tsc,eslint,prettier --checkandvitest run(233 tests) pass.Not changed here:
REMOVE_TRACKSkeeps the selected ids that were removed (filter((id) => actionIds.has(id))), which looks inverted. After a crop the kept track ends up deselected. That predates this regression, so I left it for a separate change.🤖 Generated with Claude Code