Repository navigation
Conversation
Glide reads the return value of onDelete and treats any non-boolean as the selection to delete. The generated callback returned the result of addEvents, so pressing Delete with on_delete bound threw a TypeError and left the cell unchanged. Fixes reflex-dev#7852. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
[Medium impact] This PR appears safe to merge. SummaryThis PR fixes Delete in data editors with
No actionable issues found. Reviews (2) · Last reviewed commit: "Merge branch 'main' into dataeditor-on-d..." · Reviewed by Greptile |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Type of change
Changes To Core Features:
Description
Closes #7852
Glide calls
onDeletesynchronously and uses its return value:truedeletes the selection,falsecancels, and anything else is treated as the selection to delete. Reflex renderedon_deleteas a normal event callback, which returned the result ofaddEvents(undefined). Glide then read that as a selection and threwTypeError: toDelete.rows is not iterable, so the cell kept its value even though the handler received the selection.DataEditor._rendernow wrapsonDeleteso it queues the Reflex event and then returnstrue, letting Glide delete the selection as it does whenon_deleteis not bound.useCallbackdependencies of the handler are unchanged. The cost is one small arrow function per render of the grid.onDeleteis the only one whose return value Glide uses synchronously (onRowAppendedacceptsundefined).Tests
tests/units/components/datadisplay/test_dataeditor.py): runs the renderedonDeleteunder node and asserts it returnstrueand queues exactly the expected event with the selection. Fails onmain.tests/integration/tests_playwright/test_data_editor.py): uses the app from the issue, clicks the second row, presses Delete, and asserts the handler got the selection, the cell was cleared throughon_cell_edited, and no page error occurred. Passes in dev and prod; fails onmainwith theTypeError.uv run pytest tests/units --cov: 15223 passed, coverage 81.68%.ruff check,ruff format,pyright reflex testsand the pre-commit hooks pass. The biome hook could not install locally (npm git-dependency restriction); this PR has no JS/JSON changes.packages/reflex-components-dataeditor/news/.AI-assisted: I used Claude Code to help write this change and reviewed and tested it myself.