Skip to content

Commit 22a675c

Browse files
fix for originalValue not resetting if table rows change and components are not keyed or mounted/unmounted
1 parent 1ea414a commit 22a675c

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

Diff for: src/plugin/components/VInlineAutocomplete/VInlineAutocomplete.vue

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
:to="cardFieldRef"
3838
>
3939
<v-autocomplete
40+
v-if="showField || settings.fieldOnly"
4041
v-bind="bindingSettings"
4142
v-model="modelValue"
4243
:autofocus="!settings.fieldOnly || settings.autofocus"
@@ -201,7 +202,7 @@ const error = ref<boolean>(false);
201202
const items = ref();
202203
const showField = ref<boolean>(false);
203204
const timeOpened = ref<TimeOpened>(null);
204-
let originalValue = modelValue.value;
205+
let originalValue = null;
205206
206207
207208
// ------------------------------------------------ Loading //
@@ -226,11 +227,11 @@ const theClearIcon = computed(() => {
226227
const displayValue = computed(() => {
227228
if (modelValue.value && modelValue.value[settings.itemTitle as string]) {
228229
setEmptyValue(false);
229-
230230
return modelValue.value[settings.itemTitle as string];
231231
}
232232
233233
if (modelValue.value) {
234+
setEmptyValue(false);
234235
return modelValue.value;
235236
}
236237
@@ -367,6 +368,8 @@ function toggleField() {
367368
if (closeSiblingsBus !== null && closeSiblings.value && showField.value && !settings.fieldOnly) {
368369
closeSiblingsBus.emit(response.timeOpened);
369370
}
371+
372+
originalValue = modelValue.value;
370373
}
371374
372375

Diff for: src/plugin/components/VInlineSelect/VInlineSelect.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ const error = ref<boolean>(false);
201201
const items = ref();
202202
const showField = ref<boolean>(false);
203203
const timeOpened = ref<TimeOpened>(null);
204-
let originalValue = modelValue.value;
204+
let originalValue = null;
205205
206206
207207
// ------------------------------------------------ Loading //
@@ -226,11 +226,11 @@ const theClearIcon = computed(() => {
226226
const displayValue = computed(() => {
227227
if (modelValue.value && modelValue.value[settings.itemTitle as string]) {
228228
setEmptyValue(false);
229-
230229
return modelValue.value[settings.itemTitle as string];
231230
}
232231
233232
if (modelValue.value) {
233+
setEmptyValue(false);
234234
return modelValue.value;
235235
}
236236
@@ -367,6 +367,8 @@ function toggleField() {
367367
if (closeSiblingsBus !== null && closeSiblings.value && showField.value && !settings.fieldOnly) {
368368
closeSiblingsBus.emit(response.timeOpened);
369369
}
370+
371+
originalValue = modelValue.value;
370372
}
371373
372374

Diff for: src/plugin/components/VInlineTextField/VInlineTextField.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ const empty = ref<boolean>(false);
194194
const error = ref<boolean>(false);
195195
const showField = ref<boolean>(false);
196196
const timeOpened = ref<TimeOpened>(null);
197-
let originalValue = modelValue.value;
197+
let originalValue = null;
198198
199199
200200
// ------------------------------------------------ Loading //
@@ -358,6 +358,8 @@ function toggleField() {
358358
if (closeSiblingsBus !== null && closeSiblings.value && showField.value && !settings.fieldOnly) {
359359
closeSiblingsBus.emit(response.timeOpened);
360360
}
361+
362+
originalValue = modelValue.value;
361363
}
362364
363365
@@ -434,5 +436,4 @@ onUnmounted(() => {
434436
});
435437
</script>
436438

437-
<style lang="scss" scoped>
438-
</style>
439+
<style lang="scss" scoped></style>

Diff for: src/plugin/components/VInlineTextarea/VInlineTextarea.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ const empty = ref<boolean>(false);
195195
const error = ref<boolean>(false);
196196
const showField = ref<boolean>(false);
197197
const timeOpened = ref<TimeOpened>(null);
198-
let originalValue = modelValue.value;
198+
let originalValue = null;
199199
200200
201201
// ------------------------------------------------ Loading //
@@ -358,6 +358,8 @@ function toggleField() {
358358
if (closeSiblingsBus !== null && closeSiblings.value && showField.value && !settings.fieldOnly) {
359359
closeSiblingsBus.emit(response.timeOpened);
360360
}
361+
362+
originalValue = modelValue.value;
361363
}
362364
363365
@@ -430,5 +432,4 @@ onUnmounted(() => {
430432
});
431433
</script>
432434

433-
<style lang="scss" scoped>
434-
</style>
435+
<style lang="scss" scoped></style>

0 commit comments

Comments
 (0)