Skip to content

Commit

Permalink
[C-2770] Fix issue where playlist library can disappear (#3596)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers committed Jun 14, 2023
1 parent 1d7758d commit ca50dd1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/audius-client/packages/common/src/store/cache/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ const unwrapEntry = (entry: { metadata: any }) => {
const forceUpdateKeys = new Set([
'field_visibility',
'followee_reposts',
'followee_saves',
'playlist_library'
'followee_saves'
])

// Customize lodash recursive merge to never merge
Expand All @@ -100,6 +99,12 @@ export const mergeCustomizer = (objValue: any, srcValue: any, key: string) => {
return srcValue || objValue
}

// Not every user request provides playlist_library,
// so always prefer it's existence, starting with latest
if (key === 'playlist_library') {
return objValue || srcValue
}

// Delete is unidirectional (after marked deleted, future updates are not reflected)
if (key === 'is_delete' && objValue === true && srcValue === false) {
return objValue
Expand Down

0 comments on commit ca50dd1

Please sign in to comment.