mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) do not look at content of recent actions when loading documents
Summary: This removes the need for any information drawn from the content of recent actions when loading a document. The undo/redo system does need some facts about recent actions up front. But that system has an important restriction: only actions a particular client is known to have generated can be undone by that client. So in this diff, as we store which client has performed an action, we also store the few pieces of metadata about that action that the undo/redo system needs: `linkId`, `otherId`, `rowIdHint`, `isUndo` fields. These are all small integers (or in one case a boolean). An existing limitation is that information about which client has performed which action is stored in memory in the worker, and not persisted anywhere. This diff does not change that limitation, meaning that undos continue to not survive a worker transition. A reasonable way to deal with that would be to back the store with redis. Test Plan: existing tests pass Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D3044
This commit is contained in:
@@ -1,19 +1,28 @@
|
||||
import {ActionSummary} from 'app/common/ActionSummary';
|
||||
|
||||
/** This is the action representation the client works with. */
|
||||
export interface ActionGroup {
|
||||
/**
|
||||
* This is the action representation the client works with, for the purposes of undos/redos.
|
||||
*/
|
||||
export interface MinimalActionGroup {
|
||||
actionNum: number;
|
||||
actionHash: string;
|
||||
desc?: string;
|
||||
actionSummary: ActionSummary;
|
||||
fromSelf: boolean;
|
||||
linkId: number;
|
||||
otherId: number;
|
||||
time: number;
|
||||
user: string;
|
||||
rowIdHint: number; // If non-zero, this is a rowId that would be a good place to put
|
||||
// the cursor after an undo.
|
||||
primaryAction: string; // The name of the first user action in the ActionGroup.
|
||||
isUndo: boolean; // True if the first user action is ApplyUndoActions.
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the action representation the client works with, for the purposes of document
|
||||
* history and undos/redos.
|
||||
*/
|
||||
export interface ActionGroup extends MinimalActionGroup {
|
||||
desc?: string;
|
||||
actionSummary: ActionSummary;
|
||||
time: number;
|
||||
user: string;
|
||||
primaryAction: string; // The name of the first user action in the ActionGroup.
|
||||
internal: boolean; // True if it is inappropriate to log/undo the action.
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ActionGroup} from 'app/common/ActionGroup';
|
||||
import {MinimalActionGroup} from 'app/common/ActionGroup';
|
||||
import {TableDataAction} from 'app/common/DocActions';
|
||||
import {Role} from 'app/common/roles';
|
||||
import {StringUnion} from 'app/common/StringUnion';
|
||||
@@ -41,7 +41,7 @@ export interface OpenLocalDocResult {
|
||||
docFD: number;
|
||||
clientId: string; // the docFD is meaningful only in the context of this session
|
||||
doc: {[tableId: string]: TableDataAction};
|
||||
log: ActionGroup[];
|
||||
log: MinimalActionGroup[];
|
||||
recoveryMode?: boolean;
|
||||
userOverride?: UserOverride;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user