fix(cardinal): prevent stale selection from affecting context-menu targets#140
Merged
fix(cardinal): prevent stale selection from affecting context-menu targets#140
Conversation
…rgets - require explicit target paths in `showContextMenu` - use clicked row path when right-clicking an unselected row - add App-level regression tests for file/event context-menu target resolution
There was a problem hiding this comment.
Pull request overview
Updates context-menu targeting so right-click actions always operate on the intended rows (clicked row vs current selection), eliminating stale selection from influencing menu actions.
Changes:
- Changed
useContextMenu.showContextMenuto require explicittargetPaths: string[](no longer derives targets from selection). - Updated
Approw context-menu logic to use the clicked row path when right-clicking an unselected row, otherwise use the current selection snapshot. - Added/updated tests, including an App-level regression suite for context-menu target resolution.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cardinal/src/hooks/useContextMenu.ts | Requires explicit context-menu target paths and builds menu items from provided targets. |
| cardinal/src/App.tsx | Computes correct targetPaths for file rows and wraps events context menu to pass a single-item target list. |
| cardinal/src/hooks/tests/useContextMenu.test.tsx | Updates hook tests to pass explicit targetPaths (and adds filtering coverage for empty entries). |
| cardinal/src/tests/App.contextMenu.test.tsx | Adds regression tests ensuring clicked-row vs selection targeting behavior is correct at the App level. |
| cardinal/src/hooks/tests/useRemoteSort.test.ts | Adds unit tests covering remote sort versioning, threshold behavior, and stale response handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
showContextMenu