fix: Context menu using stale selection#2414
Merged
ericlln merged 2 commits intodeephaven:release/v0.85from Apr 10, 2025
Merged
Conversation
- Although we handle the case where the grid is right-clicked outside of the current selection in `GridSelectionHandler.ts`, where the new selection will be updated to the row the cursor is on, state changes are batched in event handlers so `IrisGridContextMenuHandler.tsx` will be using a stale value for `selectedRanges` when it runs. - To fix this we can implement the exact same logic in both components, such that the selected ranges used in `onContextMenu` in `IrisGridContextMenuHandler.tsx` will be the same as what `onContextMenu` in `GridSelectionHandler.ts` will set it to after all handlers have ran. Test Snippet (any table will work though) ``` from deephaven import empty_table, input_table source = empty_table(10).update(["X = i", "Y = i"]) result = input_table(init_table=source) ``` Before this change, it was seen that right clicking any cell when the table first opens will not produce the full context menu as expected, and only subsequent clicks will open the full context menu (probably for the wrong cell). (cherry picked from commit c43f306)
…aven#2412) After merging in deephaven#2407, I thought a bit more about my implementation and decided to refactor it (before picking this back to `v0.85`) It makes more sense for `getLatestSelection` to live in `GridSelectionMouseHandler` since its logic also depends on the implementation of `onContextMenu` in this class, and this will make it more straightforward for other mouse handlers that might want to use this method to get the Grid's most recent selected ranges. (cherry picked from commit 23cefe3)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/v0.85 #2414 +/- ##
==============================================
Coverage 46.72% 46.73%
==============================================
Files 695 695
Lines 38877 38883 +6
Branches 9883 9886 +3
==============================================
+ Hits 18167 18172 +5
- Misses 20658 20659 +1
Partials 52 52
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dgodinez-dh
approved these changes
Apr 10, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Cherry-pick #2407 and #2412 to
v0.85