Skip to content

Comments

fix: Context menu using stale selection#2407

Merged
ericlln merged 4 commits intodeephaven:mainfrom
ericlln:DH-19089-context-menu-using-stale-selection
Apr 9, 2025
Merged

fix: Context menu using stale selection#2407
ericlln merged 4 commits intodeephaven:mainfrom
ericlln:DH-19089-context-menu-using-stale-selection

Conversation

@ericlln
Copy link
Contributor

@ericlln ericlln commented Apr 3, 2025

  • 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).

@ericlln ericlln self-assigned this Apr 3, 2025
@codecov
Copy link

codecov bot commented Apr 3, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 46.83%. Comparing base (0f4f238) to head (27a9dad).

Files with missing lines Patch % Lines
...d/src/mousehandlers/IrisGridContextMenuHandler.tsx 83.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2407   +/-   ##
=======================================
  Coverage   46.83%   46.83%           
=======================================
  Files         711      711           
  Lines       39307    39313    +6     
  Branches     9822     9825    +3     
=======================================
+ Hits        18408    18413    +5     
- Misses      20888    20889    +1     
  Partials       11       11           
Flag Coverage Δ
unit 46.83% <85.71%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ericlln ericlln requested review from a team and vbabich and removed request for a team April 4, 2025 14:29
@ericlln ericlln marked this pull request as ready for review April 4, 2025 14:29
@ericlln ericlln merged commit c43f306 into deephaven:main Apr 9, 2025
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants