Skip to content

Fix "Save each run as new playlist" toggle never saving - #1

Merged
Gabriel-Lewis merged 1 commit into
devfrom
fix/replace-playlist-toggle
Aug 19, 2026
Merged

Gabriel-Lewis merged 1 commit into
devfrom
fix/replace-playlist-toggle

Conversation

@Gabriel-Lewis

Copy link
Copy Markdown
Owner

Brings the fix from upstream PR LumePart#229 into this fork's dev, so it lands in the ghcr.io/gabriel-lewis/explo:dev image we actually run.

Cause

saveReplacePlaylist() posted {name, replace}, but HandleSaveReplacePlaylist resolves the playlist from body.ID:

if def, ok := defs.PlaylistDefs[body.ID]; ok {
} else if defs.CustomIDRe.MatchString(body.ID) {
} else {
    http.Error(w, "unknown playlist name", http.StatusBadRequest)
}

body.ID was always empty, so every save returned 400, and Settings.jsx rolled back its optimistic update — making the toggle appear to revert on its own.

Fix

Send {id, name, replace}, matching saveSchedule(), whose handler resolves the playlist the same way and already receives both fields.

Testing

npm run build in src/web/frontend succeeds. Only one caller of saveReplacePlaylist exists, and s.name is already in scope there.

Workaround until this is deployed: add --replace-playlist=false to the relevant *_FLAGS var in .env.

The toggle in PlaylistCard reverts immediately and the setting is never
persisted.

saveReplacePlaylist() posted {name, replace}, but HandleSaveReplacePlaylist
reads body.ID to resolve the playlist:

    if def, ok := defs.PlaylistDefs[body.ID]; ok {
    } else if defs.CustomIDRe.MatchString(body.ID) {
    } else {
        http.Error(w, "unknown playlist name", http.StatusBadRequest)

body.ID was always empty, so every request 400'd. Settings.jsx treats a
failed save as a signal to roll back its optimistic update, which is why
the toggle flips back on its own.

Send {id, name, replace} instead, matching saveSchedule() -- whose handler
resolves the playlist the same way and already receives both fields. The
handler needs id to look up the playlist definition and name to derive the
env prefix for custom playlists.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ZuEbqv1CGbPub9kB3g2s4
@Gabriel-Lewis
Gabriel-Lewis merged commit c5af338 into dev Aug 19, 2026
@Gabriel-Lewis
Gabriel-Lewis deleted the fix/replace-playlist-toggle branch August 19, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant