Skip to content

Commit 9b253e0

Browse files
committed
fix: improve cleanup logic in AppStatusModal and handle missing status filter in StatusFilterButtonComponent
- Updated AppStatusModal to ensure proper cleanup of resources on unmount. - Enhanced StatusFilterButtonComponent to handle cases where the selected tab is not found in the status filters.
1 parent 0e7e4d6 commit 9b253e0

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/Shared/Components/AppStatusModal/AppStatusModal.component.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,18 @@ const AppStatusModal = ({
8181
// eslint-disable-next-line @typescript-eslint/no-floating-promises
8282
handleExternalSync()
8383
}
84+
}, [areInitialAppDetailsLoading, fetchedAppDetails, fetchedAppDetailsError])
8485

85-
return () => {
86+
useEffect(
87+
() => () => {
8688
if (pollingTimeoutRef.current) {
8789
clearTimeout(pollingTimeoutRef.current)
8890
}
8991

9092
abortControllerRef.current.abort()
91-
}
92-
}, [areInitialAppDetailsLoading, fetchedAppDetails, fetchedAppDetailsError])
93+
},
94+
[],
95+
)
9396

9497
const handleShowConfigDriftModal = isConfigDriftEnabled
9598
? () => {

src/Shared/Components/CICDHistory/StatusFilterButtonComponent.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ export const StatusFilterButtonComponent = ({
3838

3939
useEffect(() => {
4040
const filterIndex = statusFilters.findIndex(({ status }) => status === selectedTab)
41+
42+
if (filterIndex === -1) {
43+
handleFilterClick(allResourceKindFilter.status)
44+
}
45+
4146
setOverflowFilterIndex(Math.max(filterIndex, 0))
4247
}, [JSON.stringify(statusFilters)])
4348

0 commit comments

Comments
 (0)