File tree 2 files changed +23
-1
lines changed
packages/editor-ui/src/components/MainHeader 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,23 @@ describe('Workflow Actions', () => {
108
108
cy . wait ( '@saveWorkflow' ) ;
109
109
cy . wrap ( null ) . then ( ( ) => expect ( interceptCalledCount ) . to . eq ( 1 ) ) ;
110
110
} ) ;
111
+
112
+ it ( 'should not save workflow twice when save is in progress' , ( ) => {
113
+ // This happens when users click save button from workflow name input
114
+ // In this case blur on the input saves the workflow and then click on the button saves it again
115
+ WorkflowPage . actions . visit ( ) ;
116
+ WorkflowPage . getters . workflowNameInput ( ) . invoke ( 'val' ) . then ( ( oldName ) => {
117
+ WorkflowPage . getters . workflowNameInputContainer ( ) . click ( ) ;
118
+ WorkflowPage . getters . workflowNameInput ( ) . type ( '{selectall}' ) ;
119
+ WorkflowPage . getters . workflowNameInput ( ) . type ( 'Test' ) ;
120
+ WorkflowPage . getters . saveButton ( ) . click ( ) ;
121
+ WorkflowPage . getters . workflowNameInput ( ) . should ( 'have.value' , 'Test' ) ;
122
+ cy . visit ( WorkflowPages . url ) ;
123
+ // There should be no workflow with the old name (duplicate save)
124
+ WorkflowPages . getters . workflowCards ( ) . contains ( String ( oldName ) ) . should ( 'not.exist' ) ;
125
+ } ) ;
126
+ } ) ;
127
+
111
128
it ( 'should copy nodes' , ( ) => {
112
129
WorkflowPage . actions . addNodeToCanvas ( SCHEDULE_TRIGGER_NODE_NAME ) ;
113
130
WorkflowPage . actions . addNodeToCanvas ( CODE_NODE_NAME ) ;
Original file line number Diff line number Diff line change @@ -388,6 +388,10 @@ export default defineComponent({
388
388
},
389
389
methods: {
390
390
async onSaveButtonClick() {
391
+ // If the workflow is saving, do not allow another save
392
+ if (this .isWorkflowSaving ) {
393
+ return ;
394
+ }
391
395
let currentId = undefined ;
392
396
if (this .currentWorkflowId !== PLACEHOLDER_EMPTY_WORKFLOW_ID ) {
393
397
currentId = this .currentWorkflowId ;
@@ -497,11 +501,12 @@ export default defineComponent({
497
501
cb (true );
498
502
return ;
499
503
}
500
-
504
+ this . uiStore . addActiveAction ( ' workflowSaving ' );
501
505
const saved = await this .workflowHelpers .saveCurrentWorkflow ({ name });
502
506
if (saved ) {
503
507
this .isNameEditEnabled = false ;
504
508
}
509
+ this .uiStore .removeActiveAction (' workflowSaving' );
505
510
cb (saved );
506
511
},
507
512
async handleFileImport(): Promise <void > {
You can’t perform that action at this time.
0 commit comments