adazzle / react-data-grid

Feature-rich and customizable data grid React component
https://adazzle.github.io/react-data-grid/
Other
6.93k stars 2.18k forks source link

bug: name collision in isCellEditable breaks edit feature #3356

Closed PenguinOfWar closed 1 year ago

PenguinOfWar commented 1 year ago

Issue

Under certain conditions when bundled, two identically named functions (isCellEditable) can clash.

How to replicate

  1. Import the library into next@13.5.4 or later
  2. Configure an editable cell per the common example
  3. npm run dev shows expected functionality of cell becoming editable after double click or carriage return
  4. npm run build && npm run start shows an unexpected outcome, cell edit becomes unreachable in production

Going through the compiled code with some strategic logging shows that the production build version of the code prefers the utility isCellEditable rather than the function inside DataGrid. As they accept two different arguments sets, this breaks the edit feature.

Fix

Renaming the utility to isCellEditableUtil resolves this issue. If this name isn't preferred, I am open to suggestion and happy to change it.

nstepien commented 1 year ago

Have you opened an issue in the Next.js repo?

PenguinOfWar commented 1 year ago

Have you opened an issue in the Next.js repo?

Logged a bug on next for visibility. vercel/next.js#56480

However as the fix is a minor utility name change in the source (and given the rather large backlog/potentially large turnaround time for the next teams) this felt like the best way to get a quick fix into production and hopefully prevent it from happening on any other bundlers.

nstepien commented 1 year ago

Thanks!

PenguinOfWar commented 1 year ago

Thanks for the merge @nstepien!