Skip to content

Commit d0eb6cf

Browse files
refactor(charts): remove useless conditional in onDataPointClickInternal (#8550)
To fix this, remove the duplicated `payload` operand in the `if` guard inside `onDataPointClickInternal`. The best minimal, behavior-preserving fix is: - Keep the null/truthy guard for `payload`. - Keep the function-type guard for `onDataPointClick`. - Delete only the duplicated `payload &&`. This change should be made in `packages/charts/src/components/PieChart/index.tsx` at the `onDataPointClickInternal` callback (around line 180 in the snippet). No imports, new methods, or additional definitions are required. _Suggested fixes powered by Copilot Autofix. Review carefully before merging._ Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent bfcd11a commit d0eb6cf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • packages/charts/src/components/PieChart

packages/charts/src/components/PieChart/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const PieChart = forwardRef<HTMLDivElement, PieChartProps>((props, ref) => {
177177

178178
const onDataPointClickInternal = useCallback(
179179
(payload, dataIndex, event) => {
180-
if (payload && payload && typeof onDataPointClick === 'function') {
180+
if (payload && typeof onDataPointClick === 'function') {
181181
onDataPointClick(
182182
enrichEventWithDetails(event, {
183183
value: payload.value,

0 commit comments

Comments
 (0)