react-pivottable icon indicating copy to clipboard operation
react-pivottable copied to clipboard

fix: prevent duplicate item state from React 18 double render

Open YooZiiX opened this issue 7 months ago • 0 comments

Summary

This pull request addresses a React 18-related issue where moving an item between Columns and Rows in the PivotTableUI causes duplicated state due to React 18's double rendering behavior in Strict Mode.

Changes

  • Introduced a handleDuplicates() utility to filter out duplicate items from state arrays.
  • Integrated handleDuplicates() into the propUpdater() method for rows and cols keys.
  • Added unit tests to verify that duplicate entries are not introduced during re-renders.

YooZiiX avatar Jun 03 '25 14:06 YooZiiX