-
Notifications
You must be signed in to change notification settings - Fork 247
feat(data-modeling): show previous edits when opening the diagram COMPASS-9544 #7106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements functionality to preserve edit history when opening existing data modeling diagrams, allowing users to undo previous changes made before the current session. The change ensures that when a diagram is reopened, the undo/redo functionality works with the complete edit history rather than starting fresh.
Key changes:
- Modifies the diagram reducer to preserve edit history when opening saved diagrams
- Adds comprehensive E2E test coverage for the undo functionality after reopening diagrams
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/compass-data-modeling/src/store/diagram.ts | Updates the OPEN_DIAGRAM action to reconstruct the edit history from saved edits |
| packages/compass-e2e-tests/tests/data-modeling-tab.test.ts | Adds E2E test to verify undo functionality works after reopening a diagram |
Comments suppressed due to low confidence (1)
packages/compass-data-modeling/src/store/diagram.ts:98
- The variable name '_item' indicates an unused parameter. Consider using a more descriptive name like 'edit' or simply omit the parameter name since it's not used.
const prev = current.map((_item, index, arr) => arr.slice(0, index + 1));
| action | ||
| ) => { | ||
| if (isAction(action, DiagramActionTypes.OPEN_DIAGRAM)) { | ||
| const current = action.diagram.edits; |
Copilot
AI
Jul 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic creates an array of progressively longer slices but could be clearer. Consider adding a comment explaining that this reconstructs the edit history states for undo functionality.
| const current = action.diagram.edits; | |
| const current = action.diagram.edits; | |
| // Reconstruct the edit history states for undo functionality by creating an array of progressively longer slices of the `current` edits array. |
Description
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes