Skip to content

fix(playlist): allow removing the last track from a playlist#14306

Merged
raymondjacobson merged 1 commit into
mainfrom
claude/confident-haslett-d8afe7
May 14, 2026
Merged

fix(playlist): allow removing the last track from a playlist#14306
raymondjacobson merged 1 commit into
mainfrom
claude/confident-haslett-d8afe7

Conversation

@raymondjacobson
Copy link
Copy Markdown
Member

Summary

  • UI: The trash icon in CollectionTrackFieldArray was disabled whenever only one track remained. That guard fits the upload flow (which reuses the same form) but blocked edits to existing playlists from ever emptying out. isUpload now flows through from EditCollectionForm, so the guard only applies during upload.
  • Backend: Removing the final track via the kebab menu's "Remove from playlist" appeared to succeed (optimistic update + toast) but the track reappeared on reload. In populate_playlist_record_metadata, a Python truthiness check on playlist_metadata["playlist_contents"] treated the SDK's empty-array payload ([]) as if the field were omitted and silently skipped the update. Switched to is None so an explicit empty list is applied. Downstream update_playlist_tracks already handles an empty track_ids correctly (marks all existing rows removed).

Repro

  1. Visit a playlist with one track.
  2. Track kebab → "Remove from playlist".
  3. Confirmer succeeds, toast shows, track disappears from view.
  4. Reload — track is still there.

Also: open the same playlist via "Edit Playlist" — the trash icon on the only row was disabled.

Test plan

  • Edit-playlist form: remove the final track and save → playlist is empty on reload.
  • Track kebab → "Remove from playlist" on a one-track playlist → playlist is empty on reload.
  • Regression: removing one of several tracks still works in both paths.
  • Regression: upload flow still prevents bottoming out at zero tracks.
  • Backend regression: playlist_contents: {"track_ids": []} (legacy dict form, used in existing tests) continues to update correctly.

🤖 Generated with Claude Code

The trash icon on each row in the edit-collection form was disabled
whenever only one track remained. That guard makes sense for the upload
flow (which reuses the same component) but blocked edits to existing
playlists from ever emptying out. Thread `isUpload` through
`CollectionTrackFieldArray` so the guard only applies during upload.

Even via the kebab menu's "Remove from playlist" path, the removal of
the final track confirmed client-side but reappeared on reload. In the
discovery-provider entity manager, `populate_playlist_record_metadata`
was using a truthiness check on `playlist_metadata["playlist_contents"]`
— an empty list (the SDK's serialization for "no tracks") is falsy in
Python, so the field was silently treated as omitted. Compare with
`is None` instead so an explicit empty list is applied.
`update_playlist_tracks` already handles an empty `track_ids`
correctly (marks all existing rows removed).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 13, 2026

⚠️ No Changeset found

Latest commit: cc83496

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14306.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

@raymondjacobson raymondjacobson merged commit 26e0fd9 into main May 14, 2026
14 checks passed
@raymondjacobson raymondjacobson deleted the claude/confident-haslett-d8afe7 branch May 14, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant