Skip to content

Commit

Permalink
[C-2428] Handle null in cache map handle/permalink adds (#3184)
Browse files Browse the repository at this point in the history
  • Loading branch information
amendelsohn authored Apr 6, 2023
1 parent 0559902 commit cfb0b96
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/common/src/store/cache/collections/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const actionsMap = {
): CollectionsCacheState {
const { permalink, collectionId } = action

if (!permalink) return state
return {
...state,
permalinks: {
Expand Down
5 changes: 4 additions & 1 deletion packages/common/src/store/cache/tracks/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ const actionsMap = {
for (const entry of entries) {
const { track_id, permalink } = entry.metadata

newPermalinks[permalink.toLowerCase()] = track_id
if (permalink) {
newPermalinks[permalink.toLowerCase()] = track_id
}
}

return {
Expand All @@ -41,6 +43,7 @@ const actionsMap = {
): TracksCacheState {
const { permalink, trackId } = action

if (!permalink) return state
return {
...state,
permalinks: { ...state.permalinks, [permalink.toLowerCase()]: trackId }
Expand Down
4 changes: 3 additions & 1 deletion packages/common/src/store/cache/users/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ const actionsMap = {

for (const entry of entries) {
const { user_id, handle } = entry.metadata
newHandles[handle.toLowerCase()] = user_id
if (handle) {
newHandles[handle.toLowerCase()] = user_id
}
}

return {
Expand Down

0 comments on commit cfb0b96

Please sign in to comment.