Skip to content

Commit 8ce46e7

Browse files
Refactor failedSections handling in appStateReducer for improved clarity and consistency
1 parent db96c2e commit 8ce46e7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/frontend/src/state/AppReducer.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,16 @@ export const appStateReducer = (state: AppState, action: Action): AppState => {
108108
case 'SET_IS_REQUEST_INITIATED' :
109109
return {...state, isRequestInitiated : action.payload}
110110
case 'ADD_FAILED_SECTION':
111-
var tempFailedSections = [...state.failedSections];
112-
const exists = tempFailedSections.some((item) => item.title === action.payload.title);
113-
if (!exists) {
111+
const tempFailedSections = [...state.failedSections];
112+
const exists = tempFailedSections.some((item) => item.title === action.payload.title);
113+
if (!exists) {
114114
tempFailedSections.push(action.payload);
115-
}
116-
return { ...state , failedSections : [...tempFailedSections] }
117-
case 'REMOVED_FAILED_SECTION' :
118-
var tempFailedSections = state.failedSections.filter((item) => item.title !== action.payload.section.title);
119-
return { ...state , failedSections : [...tempFailedSections] }
120-
case 'UPDATE_SECTION_API_REQ_STATUS' :
115+
}
116+
return { ...state, failedSections: [...tempFailedSections] }
117+
case 'REMOVED_FAILED_SECTION':
118+
const filteredFailedSections = state.failedSections.filter((item) => item.title !== action.payload.section.title);
119+
return { ...state, failedSections: filteredFailedSections }
120+
case 'UPDATE_SECTION_API_REQ_STATUS':
121121
return {...state, isFailedReqInitiated : action.payload}
122122

123123
case 'UPDATE_IS_LOADED_SECTIONS' :

0 commit comments

Comments
 (0)