Conversation
12 tasks
This requires adding some machinery to track whether undo/redo events should apply to the current diagram (by testing whether no element outside of the diagram is focused), as well as accounting for the fact that the diagram also has hotkey handlers that can be triggered by the same keyboard presses.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds undo/redo functionality integration with the Electron application menu for the data modeling diagram editor. The implementation ensures that undo/redo operations triggered from the application menu only apply when the diagram editor has focus, and handles the case where the same keyboard shortcut might trigger handlers from both the hotkey listener and the application menu.
Key changes:
- Added focus state tracking to determine when the diagram editor should respond to menu commands
- Implemented debouncing logic to prevent duplicate handler invocations from multiple event sources
- Integrated application menu handlers for undo/redo operations
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/compass-data-modeling/src/utils/utils.ts | Adds dualSourceHandlerDebounce utility to prevent duplicate event handling |
| packages/compass-data-modeling/src/utils/utils.spec.tsx | Adds tests for the debounce utility function |
| packages/compass-data-modeling/src/components/diagram-editor.tsx | Adds focus state tracking to the diagram editor component |
| packages/compass-data-modeling/src/components/diagram-editor-toolbar.tsx | Integrates application menu handlers with hotkey handlers using debouncing |
| packages/compass-data-modeling/package.json | Adds dependency on compass-electron-menu package |
| packages/compass-components/src/index.ts | Exports new useFocusStateIncludingUnfocused hook |
| packages/compass-components/src/hooks/use-focus-hover.ts | Implements hook to detect when document is unfocused |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
mabaasit
approved these changes
Oct 27, 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 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.
Split into two PRs (this one and #7493) for easier review and because I'm honestly quite sure that we want to do #7493, but the data-modeling specific parts add a bit of complexity that we should agree is worth it before we mergechore: refactor and centralize app menu access (#7493)Instead of having the logic for accessing the Electron application menufrom the collection tabs spread out through the codebase, bundle it
in a single interface that gives all Compass plugins access to
the menu as needed.
feat(data-modeling): add undo/redo application menu interactions
This requires adding some machinery to track whether undo/redo
events should apply to the current diagram (by testing whether
no element outside of the diagram is focused), as well as
accounting for the fact that the diagram also has hotkey handlers
that can be triggered by the same keyboard presses.