Fixed: Don't try to render quality when it's null

This commit is contained in:
Qstick 2020-09-27 11:44:14 -04:00
parent a773f9e135
commit 2b9cd64dad
2 changed files with 12 additions and 9 deletions

View File

@ -35,6 +35,10 @@ function TrackQuality(props) {
isCutoffNotMet
} = props;
if (!quality) {
return null;
}
return (
<Label
className={className}

View File

@ -260,17 +260,16 @@ export const reducers = createHandleActions({
const guid = payload.guid;
const newState = Object.assign({}, state);
const items = newState.items;
// Return early if there aren't any items (the user closed the modal)
if (!items.length) {
return;
}
const index = items.findIndex((item) => item.guid === guid);
const item = Object.assign({}, items[index], payload);
newState.items = [...items];
newState.items.splice(index, 1, item);
// Don't try to update if there isnt a matching item (the user closed the modal)
if (index >= 0) {
const item = Object.assign({}, items[index], payload);
newState.items = [...items];
newState.items.splice(index, 1, item);
}
return newState;
},