Skip to content

Commit f4528ed

Browse files
[25.1] Add conditional debounce to FormText to prevent value resetting
We have a bug where in the workflow editor, while typing in a text form element, the value can get unexpectedly trimmed or reset because of the `build_module` API call updating the values. Adding a debounce of 1 second solves this problem; as we now wait for the user to type out their entire value first. This debounce is set if the `workflowBuildingMode` prop is set for `FormElement`. Fixes #21205
1 parent e81e2b7 commit f4528ed

File tree

7 files changed

+29
-4
lines changed

7 files changed

+29
-4
lines changed

client/src/components/Form/Elements/FormOptionalText.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
:placeholder="placeholder"
1414
:multiple="multiple"
1515
:datalist="datalist"
16+
:debounce="debounce"
1617
:type="type" />
1718
</div>
1819
</template>
@@ -59,6 +60,10 @@ export default {
5960
type: Array,
6061
default: null,
6162
},
63+
debounce: {
64+
type: Number,
65+
default: 0,
66+
},
6267
},
6368
data() {
6469
return {

client/src/components/Form/Elements/FormText.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
:id="id"
77
v-model="currentValue"
88
:class="['ui-text-area', cls]"
9+
:debounce="debounce"
910
:readonly="readonly"
1011
:placeholder="placeholder"
1112
:style="style" />
@@ -14,6 +15,7 @@
1415
:id="id"
1516
v-model="currentValue"
1617
:class="['ui-input', cls]"
18+
:debounce="debounce"
1719
:readonly="readonly"
1820
:placeholder="placeholder"
1921
:state="showState ? (!currentValue ? (optional ? null : false) : true) : null"
@@ -82,6 +84,10 @@ export default {
8284
type: Array,
8385
default: null,
8486
},
87+
debounce: {
88+
type: Number,
89+
default: 0,
90+
},
8591
},
8692
computed: {
8793
acceptedTypes() {

client/src/components/Form/FormElement.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ const extendedCollectionType = computed<ExtendedCollectionType>(() => {
393393
:placeholder="computedPlaceholder"
394394
:multiple="attrs.multiple"
395395
:datalist="attrs.datalist"
396+
:debounce="'debounce' in attrs ? attrs.debounce : props.workflowBuildingMode ? 1000 : 0"
396397
:type="props.type" />
397398
<FormText
398399
v-else-if="
@@ -413,6 +414,7 @@ const extendedCollectionType = computed<ExtendedCollectionType>(() => {
413414
:multiple="attrs.multiple"
414415
:cls="attrs.cls"
415416
:datalist="attrs.datalist"
417+
:debounce="'debounce' in attrs ? attrs.debounce : props.workflowBuildingMode ? 1000 : 0"
416418
:type="props.type" />
417419
<FormSelection
418420
v-else-if="

client/src/components/Workflow/Editor/Forms/FormColumnDefinition.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ watch(defaultString, setDefaultByType);
206206
type="text"
207207
:error="nameError"
208208
help="Provide a short, unique name to describe this column."
209+
workflow-building-mode
209210
@input="onName" />
210211
<FormColumnDefinitionType :value="value.type" :prefix="prefix" @onChange="onType" />
211212
<FormElement
@@ -215,6 +216,7 @@ watch(defaultString, setDefaultByType);
215216
title="Description"
216217
type="text"
217218
help="Provide a longer description to help people running this workflow under what is expected to be entered in this column."
219+
workflow-building-mode
218220
@input="onDescription" />
219221
<FormElement
220222
v-if="value.type == 'string'"
@@ -224,6 +226,7 @@ watch(defaultString, setDefaultByType);
224226
title="Restrict or Suggest Text Values?"
225227
:optional="false"
226228
type="select"
229+
workflow-building-mode
227230
@input="onEnumerateType" />
228231
<FormElement
229232
v-if="value.type == 'string' && enumerateType == 'staticRestrictions'"
@@ -232,6 +235,7 @@ watch(defaultString, setDefaultByType);
232235
title="Restricted Values"
233236
type="text"
234237
help="Comma-separated list of all permitted values"
238+
workflow-building-mode
235239
@input="onRestrictions" />
236240
<FormElement
237241
v-if="value.type == 'string' && enumerateType == 'staticSuggestions'"
@@ -240,6 +244,7 @@ watch(defaultString, setDefaultByType);
240244
title="Suggested Values"
241245
type="text"
242246
help="Comma-separated list of all suggested values"
247+
workflow-building-mode
243248
@input="onSuggestions" />
244249
<BFormCheckbox :id="prefix + '_optional'" v-model="isOptional"> Is this input optional? </BFormCheckbox>
245250
<div class="ui-form-title">
@@ -249,23 +254,27 @@ watch(defaultString, setDefaultByType);
249254
v-if="value.type == 'int'"
250255
:id="prefix + '_default_value'"
251256
v-model="defaultIntAsStr"
252-
type="integer" />
257+
type="integer"
258+
workflow-building-mode />
253259
<FormElement
254260
v-if="value.type == 'float'"
255261
:id="prefix + '_default_value'"
256262
v-model="defaultFloatAsStr"
257-
type="float" />
263+
type="float"
264+
workflow-building-mode />
258265
<FormElement
259266
v-if="value.type == 'string'"
260267
:id="prefix + '_default_value'"
261268
v-model="defaultString"
262-
type="text" />
269+
type="text"
270+
workflow-building-mode />
263271
<FormElement
264272
v-if="value.type == 'boolean'"
265273
:id="prefix + '_default_value'"
266274
v-model="defaultBoolean"
267275
:attributes="{ data: booleanOptions }"
268-
type="select" />
276+
type="select"
277+
workflow-building-mode />
269278

270279
<!--
271280
TODO: There are more fields to enter here including validations that vary based on the type chosen. There will

client/src/components/Workflow/Editor/Forms/FormDefault.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
:id="formDisplayId"
5656
:key="formKey"
5757
:inputs="configForm.inputs"
58+
workflow-building-mode
5859
@onChange="onChange" />
5960
<div v-if="isSubworkflow">
6061
<FormOutputLabel

client/src/components/Workflow/Editor/Forms/FormInputCollection.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ emit("onChange", cleanToolState());
141141
:optional="true"
142142
type="text"
143143
help="Tags to automatically filter inputs"
144+
workflow-building-mode
144145
@input="onTags" />
145146
<FormColumnDefinitions
146147
v-if="isSampleSheetType"

client/src/components/Workflow/Editor/Forms/FormRecordFieldDefinition.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function onType(newType: FieldType) {
3939
title="Name"
4040
type="text"
4141
help="Provide a short, unique name to describe this field."
42+
workflow-building-mode
4243
@input="onName" />
4344
<FormFieldType :prefix="prefix" :value="value.type" @onChange="onType" />
4445
</div>

0 commit comments

Comments
 (0)