Skip to content

Commit

Permalink
usecallback to be safe for handleiconclick fct
Browse files Browse the repository at this point in the history
  • Loading branch information
kianamcc committed Mar 6, 2025
1 parent d0d83bd commit 943de4f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/synapse-react-client/src/components/IconList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMemo } from 'react'
import { useCallback, useMemo } from 'react'
import IconSvg, { IconSvgProps } from './IconSvg/IconSvg'
import { merge } from 'lodash-es'
import { useQueryContext } from './QueryContext'
Expand Down Expand Up @@ -34,12 +34,15 @@ function IconList(props: IconListProps) {
const queryContext = useQueryContext()
const { addValueToSelectedFacet } = queryContext

const handleIconClick = (dataType: 'string') => {
const facet: UniqueFacetIdentifier = {
columnName: 'dataType',
}
addValueToSelectedFacet(facet, dataType)
}
const handleIconClick = useCallback(
(dataType: 'string') => {
const facet: UniqueFacetIdentifier = {
columnName: 'dataType',
}
addValueToSelectedFacet(facet, dataType)
},
[addValueToSelectedFacet],
)

const mergedIconConfigs: IconConfigs = useMemo(() => {
const mergedIconConfigs: IconConfigs = {}
Expand Down

0 comments on commit 943de4f

Please sign in to comment.