Skip to content

Commit 8f3db0e

Browse files
committed
fix: improve readability of filteredChartList computation in ChartsList component
1 parent c0461af commit 8f3db0e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/charts/list/ChartsList.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ export const ChartsList = ({ chartsList, isLoading }: ChartsListProps) => {
7474
}, [isFetching, isSuccess])
7575

7676
// COMPUTED VALUES
77-
const filteredChartList = useMemo(
78-
() => (chartsList ?? []).filter((chart) => chart.name.toLowerCase().indexOf(searchText.toLowerCase()) >= 0),
79-
[chartsList, searchText],
80-
)
77+
const filteredChartList = useMemo(() => {
78+
const searchTextLowerCase = searchText.toLowerCase()
79+
return (chartsList ?? []).filter((chart) => chart.name.toLowerCase().indexOf(searchTextLowerCase) >= 0)
80+
}, [chartsList, searchText])
8181

8282
// HANDLERS
8383
const handleSourceBtnClick = () => {

0 commit comments

Comments
 (0)