Thanks to visit codestin.com
Credit goes to GitHub.com

Skip to content

Conversation

@sergeyteleshev
Copy link
Contributor

closes dbeaver/pro#7614

Comment on lines 553 to 563
if (isSameKey) {
this.history.update(lastIndex, {
data: {
key,
value,
prevValue,
},
});

return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about this, because you might change same cell few times with a delay and when you will revert it you will expect that it will revert to previous edit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I compress everything to 1 history item unless we are currently editing the cell. If we're editing the cell right now, it remembers each typed letter. Then, if we type something in another cell, it compresses all of the history for previous cells to 1 item by cell

Comment on lines 48 to 52
type IGridEditHistoryData<TKey extends IGridDataKey = IGridDataKey, TCell = unknown> = {
key: TKey;
value: TCell;
prevValue: TCell;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use interface for consistency in codebase

Copy link
Contributor

Copilot AI left a 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 pull request implements comprehensive undo/redo functionality for the Data Editor in CloudBeaver. The implementation introduces a history tracking system that records all editing operations (cell edits, row additions/deletions, duplications, reverts, and cancellations) and allows users to undo and redo these operations using keyboard shortcuts (Ctrl+Z for undo, Ctrl+Shift+Z or Ctrl+Y for redo).

Changes:

  • Introduced a new history management system with GridHistoryAction, GridHistoryTypes, GridHistoryHandlers, and GridEditHistoryManager classes
  • Integrated history tracking into GridEditAction and ResultSetEditAction to record all editing operations
  • Added keyboard bindings and UI integration for undo/redo actions in the data viewer

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
webapp/packages/plugin-help/src/Shortcuts/SHORTCUTS_DATA.ts Added undo/redo shortcuts to the help documentation
webapp/packages/plugin-data-viewer/src/module.ts Registered GridHistoryAction in the dependency injection container
webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenuService.ts Added undo/redo key bindings, action handlers, and menu integration
webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/ResultSetEditAction.ts Integrated GridHistoryAction into ResultSetEditAction constructor
webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/Grid/GridHistoryTypes.ts Defined type structures for different history entry types and type guard functions
webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/Grid/GridHistoryHandlers.ts Implemented undo/redo handlers for each operation type
webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/Grid/GridHistoryAction.ts Core history action class with undo/redo stack management and compression support
webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/Grid/GridEditHistoryManager.ts Manager class that coordinates history recording with editor operations
webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/Grid/GridEditAction.ts Integrated history tracking into all editing operations and added internal methods for undo/redo
webapp/packages/plugin-data-viewer/src/DATA_VIEWER_KEY_BINDINGS.ts Defined key binding configurations for data viewer undo/redo
webapp/packages/core-utils/src/isNumber.ts Improved type guard to enable proper type narrowing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sergeyteleshev sergeyteleshev marked this pull request as ready for review January 21, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants