Skip to content

fix: preserve cell identity in commit callbacks - #439

Open
sameerdeolalikar wants to merge 1 commit into
iddan:masterfrom
sameerdeolalikar:fix/cell-commit-identity
Open

sameerdeolalikar wants to merge 1 commit into
iddan:masterfrom
sameerdeolalikar:fix/cell-commit-identity

Conversation

@sameerdeolalikar

Copy link
Copy Markdown

Closes #428. Fixes #272.

After editing one cell and deleting another, onCellCommit can report the last edited cell's coordinates instead of the deleted cell. Entering and leaving an unchanged cell can also emit a commit with a null previous value, and replacing the callback can replay the last commit.

Store the coordinate with each internally produced commit rather than deriving it from the global lastChanged field. Track actual edit entry/exit to retain the pre-edit value, and advance the delivered-commit reference before invoking callbacks. Clear, paste and cut/paste paths now attach their own coordinates; single-cell cut/paste also reports the removed source. The coordinate is optional in the exported commit type to preserve compatibility with externally constructed records, with the existing coordinate fallback retained.

Validation:

  • Three new component regressions fail on unchanged upstream source: wrong clear coordinate, unchanged-edit notification, and callback replay.
  • Full suite: 282 tests across 24 suites pass. Added tests also cover per-cell paste coordinates and separate source/destination notifications for cut/paste.
  • Type checking, ESLint/stylelint and production build pass. ESLint retains the existing unrelated hook-dependency warning at Spreadsheet.tsx:223.
  • Formatting passes for all modified files. The repository-wide formatting command fails on unchanged rollup.config.mjs import-attribute syntax, website/docusaurus.config.ts syntax, and two website formatting warnings; these files are outside this patch.

The interaction checks use the repository's React Testing Library/JSDOM suite; no browser-rendering claim is made.

Implementation and regression tests were prepared with AI assistance. The checks above were executed locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

onCellCommit() submit wrong cell (coords are not updated) onCellCommit() prop causing prevCell to be null on first trigger

1 participant