Commit c43f306
authored
fix: Context menu using stale selection (#2407)
- 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).1 parent 1909fac commit c43f306
File tree
3 files changed
+87
-2
lines changed- packages
- grid/src/mouse-handlers
- iris-grid/src/mousehandlers
3 files changed
+87
-2
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| |||
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
152 | 178 | | |
153 | 179 | | |
154 | 180 | | |
| |||
886 | 912 | | |
887 | 913 | | |
888 | 914 | | |
889 | | - | |
| 915 | + | |
890 | 916 | | |
891 | 917 | | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
892 | 924 | | |
893 | 925 | | |
894 | 926 | | |
| |||
0 commit comments