pull/2092/head
filip mertens 3 years ago
parent fe8f8114c8
commit a510ba9ab2
  1. 28
      libs/remix-ui/search/src/lib/reducers/Reducer.ts

@ -36,19 +36,23 @@ export const SearchReducer = (state: SearchState = SearchingInitialState, action
count: 0 count: 0
} }
case 'UPDATE_COUNT': case 'UPDATE_COUNT':
const findFile = state.searchResults.find(file => file.filename === action.payload.file) if (state.searchResults) {
let count = 0 const findFile = state.searchResults.find(file => file.filename === action.payload.file)
if (findFile) { let count = 0
findFile.count = action.payload.count if (findFile) {
} findFile.count = action.payload.count
state.searchResults.forEach(file => {
if (file.count) {
count += file.count
} }
}) state.searchResults.forEach(file => {
return { if (file.count) {
...state, count += file.count
count: count }
})
return {
...state,
count: count
}
} else {
return state
} }
case 'TOGGLE_CASE_SENSITIVE': case 'TOGGLE_CASE_SENSITIVE':
return { return {

Loading…
Cancel
Save