Skip to content

Commit

Permalink
feat(heatmap): fix missing hooks deps
Browse files Browse the repository at this point in the history
  • Loading branch information
plouc committed Jan 12, 2022
1 parent 37136c9 commit 7025bb9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/heatmap/src/HeatMapCanvas.tsx
Expand Up @@ -164,6 +164,7 @@ const InnerHeatMapCanvas = <Datum extends HeatMapDatum, ExtraProps extends objec
})
}, [
canvasEl,
layers,
cells,
outerWidth,
outerHeight,
Expand Down Expand Up @@ -234,7 +235,7 @@ const InnerHeatMapCanvas = <Datum extends HeatMapDatum, ExtraProps extends objec

onClick?.(activeCell, event)
},
[cells, activeCell, onClick]
[activeCell, onClick]
)

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/heatmap/src/HeatMapCellCircle.tsx
Expand Up @@ -22,7 +22,7 @@ const NonMemoizedHeatMapCellCircle = <Datum extends HeatMapDatum>({
onMouseLeave: onMouseLeave ? onMouseLeave(cell) : undefined,
onClick: onClick ? onClick(cell) : undefined,
}),
[cell, onMouseEnter, onMouseMove, onMouseLeave]
[cell, onMouseEnter, onMouseMove, onMouseLeave, onClick]
)

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/heatmap/src/HeatMapCellRect.tsx
Expand Up @@ -23,7 +23,7 @@ const NonMemoizedHeatMapCellRect = <Datum extends HeatMapDatum>({
onMouseLeave: onMouseLeave ? onMouseLeave(cell) : undefined,
onClick: onClick ? onClick(cell) : undefined,
}),
[cell, onMouseEnter, onMouseMove, onMouseLeave]
[cell, onMouseEnter, onMouseMove, onMouseLeave, onClick]
)

return (
Expand Down
13 changes: 12 additions & 1 deletion packages/heatmap/src/hooks.ts
Expand Up @@ -251,7 +251,18 @@ export const useHeatMap = <

return computedCell
}),
[cells, getColor, getBorderColor, getLabelTextColor, formatValue, getLabel, activeIds]
[
cells,
getColor,
getBorderColor,
getLabelTextColor,
formatValue,
getLabel,
activeIds,
opacity,
activeOpacity,
inactiveOpacity,
]
)

return {
Expand Down

0 comments on commit 7025bb9

Please sign in to comment.