Skip to content

Commit

Permalink
Keep playlist items after /api/now refetch, fixes #2768 (#2791)
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop authored Dec 6, 2023
1 parent 4094979 commit 7326436
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/reducers/playlists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,8 @@ const slice = createSlice({
const activePlaylist = state.playlists[payload.activePlaylist];
// Probably overly defensive, but avoid a crash if we got inconsistent data
const size = activePlaylist ? activePlaylist.size : 1;
const playlistItems = Array(size).fill(null);
playlistItems[0] = item;
state.playlistItems[payload.activePlaylist] = playlistItems;
state.playlistItems[payload.activePlaylist] ??= Array(size).fill(null);
state.playlistItems[payload.activePlaylist]![0] = item;
}
state.activePlaylistID = payload.activePlaylist;
// Select the first playlist by default if there is no active playlist.
Expand Down

0 comments on commit 7326436

Please sign in to comment.