Skip to content

Commit 5e0d7a0

Browse files
committed
refactor: update SegmentedControl dependencies and improve StatusFilterButtonComponent logic
1 parent 9b253e0 commit 5e0d7a0

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/Common/SegmentedControl/SegmentedControl.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const SegmentedControl = ({
3434
style.setProperty('--segmented-control-highlight-width', `${offsetWidth}px`)
3535
style.setProperty('--segmented-control-highlight-x-position', `${offsetLeft}px`)
3636
}
37-
}, [segmentValue, size, fullWidth])
37+
}, [segmentValue, size, fullWidth, segments.length])
3838

3939
const handleSegmentChange = (updatedSegment: SegmentType) => {
4040
if (isUnControlledComponent) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const AppStatusModal = ({
101101
: null
102102

103103
const handleCloseConfigDriftModal = () => {
104+
handleClose()
104105
setShowConfigDriftModal(false)
105106
}
106107

src/Shared/Components/CICDHistory/StatusFilterButtonComponent.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { useEffect, useMemo, useState } from 'react'
17+
import { useEffect, useState } from 'react'
1818

1919
import { ReactComponent as ICCaretDown } from '@Icons/ic-caret-down.svg'
2020
import { SegmentType } from '@Common/SegmentedControl/types'
@@ -48,7 +48,7 @@ export const StatusFilterButtonComponent = ({
4848

4949
const showOverflowFilters = maxInlineFiltersCount > 0 && statusFilters.length > maxInlineFiltersCount
5050

51-
const inlineFilters = useMemo(() => {
51+
const getInlineFilters = () => {
5252
if (showOverflowFilters) {
5353
const min = Math.max(0, Math.min(overflowFilterIndex - 1, statusFilters.length - maxInlineFiltersCount))
5454
const max = Math.min(min + maxInlineFiltersCount, statusFilters.length)
@@ -57,7 +57,9 @@ export const StatusFilterButtonComponent = ({
5757
}
5858

5959
return statusFilters
60-
}, [statusFilters.length, overflowFilterIndex, maxInlineFiltersCount])
60+
}
61+
62+
const inlineFilters = getInlineFilters()
6163

6264
const handleInlineFilterClick = (segment: SegmentType) => {
6365
const { value } = segment

0 commit comments

Comments
 (0)