Skip to content

Commit

Permalink
Library sidebar uses unique React keys (#592)
Browse files Browse the repository at this point in the history
* Library sidebar uses unique React keys

* Fix SCAN_START and SCAN_STOP actions
  • Loading branch information
niamu authored Dec 10, 2023
1 parent 3a5f225 commit 19e68e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/src/Components/Sidebar/Libraries.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function Libraries() {

// FETCH_LIBRARIES_OK
if (fetched && !error && items.length > 0) {
libs = items.map((props, i) => <Library {...props} key={i} />);
libs = items.map((props) => <Library {...props} key={props.id} />);
}

if (libraries.items.length === 0) return null;
Expand Down
4 changes: 2 additions & 2 deletions ui/src/reducers/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@ export default function libraryReducer(state = initialState, action) {
case SCAN_START:
return {
...state,
scanning: [...scanning, action.id],
scanning: [...state.scanning, action.id],
};
case SCAN_STOP:
return {
...state,
scanning: scanning.filter((id) => id !== action.id),
scanning: state.scanning.filter((id) => id !== action.id),
};
default:
return state;
Expand Down

0 comments on commit 19e68e0

Please sign in to comment.