Repository navigation
Fix "Save each run as new playlist" toggle never saving - #229
Closed
Gabriel-Lewis wants to merge 1 commit into
Closed
Gabriel-Lewis wants to merge 1 commit into
Gabriel-Lewis wants to merge 1 commit into
Conversation
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
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.
The Save each run as new playlist toggle in the playlist card flips back on its own and the setting is never written to
.env.Cause
saveReplacePlaylist()posts{name, replace}:but
HandleSaveReplacePlaylistresolves the playlist frombody.ID:body.IDis always empty, so it matches neither branch and every request returns 400.Settings.jsxrolls back its optimistic update when the save rejects:which is what makes the toggle appear to revert.
Fix
Send
{id, name, replace}, matchingsaveSchedule()— whose handler resolves the playlist with the samePlaylistDefs/CustomIDRelogic and already receives both fields. The handler needsidto look up the definition andnameto derive the env prefix for custom playlists viautil.CustomEnvPrefix(body.Name).Testing
npm run buildinsrc/web/frontendsucceeds. Verified by inspection thats.nameis in scope at the call site — it is the same value already passed tosaveSchedule(id, s.name, ...)a few lines above, inside the samescheduleProps(id)closure.Workaround for anyone hitting this before it merges: add
--replace-playlist=falseto the relevant*_FLAGSvariable in.env, which is all the handler does.