Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
memoize chart options
Browse files Browse the repository at this point in the history
  • Loading branch information
groninge01 committed Sep 18, 2024
1 parent fb58862 commit 22943ed
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/modules/marketing/useEcosystemPoolActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ export function useEcosystemPoolActivityChart() {
chainIn: supportedNetworks,
})

const memoizedChartOptions = useMemo(() => {
return getDefaultPoolActivityChartOptions(theme, toCurrency, isMobile, is2xl)
}, [theme, toCurrency, isMobile, is2xl])

const chartData = useMemo(() => {
if (!response) return getDefaultChainMeta()
const { poolEvents: events } = response
Expand Down Expand Up @@ -429,7 +433,7 @@ export function useEcosystemPoolActivityChart() {

return {
isLoading: loading,
chartOption: getDefaultPoolActivityChartOptions(theme, toCurrency, isMobile, is2xl),
chartOption: memoizedChartOptions,
eChartsRef,
chartData,
tabsList,
Expand Down

0 comments on commit 22943ed

Please sign in to comment.