@@ -816,6 +816,23 @@ const isHighFrequencyFormChangeAction = isAnyOf(
816
816
formElementContainerDataChanged
817
817
) ;
818
818
819
+ // Match workflow changes that are high frequency and should be grouped together - for example, when a user is
820
+ // updating the workflow description, we don't want to create a new undo group for every keystroke.
821
+ const isHighFrequencyWorkflowDetailsAction = isAnyOf (
822
+ workflowNameChanged ,
823
+ workflowDescriptionChanged ,
824
+ workflowTagsChanged ,
825
+ workflowAuthorChanged ,
826
+ workflowNotesChanged ,
827
+ workflowVersionChanged ,
828
+ workflowContactChanged
829
+ ) ;
830
+
831
+ // Match node-scoped actions that are high frequency and should be grouped together - for example, when a user is
832
+ // updating the node label, we don't want to create a new undo group for every keystroke. Or when a user is writing
833
+ // a note in a notes node, we don't want to create a new undo group for every keystroke.
834
+ const isHighFrequencyNodeScopedAction = isAnyOf ( nodeLabelChanged , nodeNotesChanged , notesNodeValueChanged ) ;
835
+
819
836
export const nodesUndoableConfig : UndoableOptions < NodesState , UnknownAction > = {
820
837
limit : 64 ,
821
838
undoType : nodesSlice . actions . undo . type ,
@@ -826,21 +843,31 @@ export const nodesUndoableConfig: UndoableOptions<NodesState, UnknownAction> = {
826
843
return history . group ;
827
844
}
828
845
if ( isHighFrequencyFieldChangeAction ( action ) ) {
829
- // Group high frequency field changes together when they are of the same type and for the same field
846
+ // Group by type, node id and field name
830
847
const { type, payload } = action ;
831
848
const { nodeId, fieldName } = payload ;
832
849
return `${ type } -${ nodeId } -${ fieldName } ` ;
833
850
}
834
851
if ( isDimensionsOrPositionAction ( action ) ) {
835
852
const ids = action . payload . map ( ( change ) => change . id ) . join ( ',' ) ;
853
+ // Group by type and node ids
836
854
return `dimensions-or-position-${ ids } ` ;
837
855
}
838
856
if ( isHighFrequencyFormChangeAction ( action ) ) {
839
- // Group high frequency form changes together when they are of the same type and for the same element
857
+ // Group by type and form element id
840
858
const { type, payload } = action ;
841
859
const { id } = payload ;
842
860
return `${ type } -${ id } ` ;
843
861
}
862
+ if ( isHighFrequencyWorkflowDetailsAction ( action ) ) {
863
+ return 'workflow-details' ;
864
+ }
865
+ if ( isHighFrequencyNodeScopedAction ( action ) ) {
866
+ const { type, payload } = action ;
867
+ const { nodeId } = payload ;
868
+ // Group by type and node id
869
+ return `${ type } -${ nodeId } ` ;
870
+ }
844
871
return null ;
845
872
} ,
846
873
filter : ( action , _state , _history ) => {
0 commit comments