Skip to content

Commit c44f455

Browse files
Merge pull request #53 from webdevnerdstuff/dev
Fix unexpected side effect in computed function
2 parents 86a4d63 + 457e874 commit c44f455

File tree

8 files changed

+395
-360
lines changed

8 files changed

+395
-360
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ All notable changes to the "vuetify-inline-fields" plugin will be documented in
55
2024-03-13
66
[main] (@webdevnerdstuff)
77
* Change component to use `defineAsyncComponent`
8+
* Fix unexpected side effect in computed function
89

910
## v1.0.6
1011
2024-02-26

dist/vuetify-inline-fields.cjs.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vuetify-inline-fields.es.js

+364-348
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/plugin/components/VInlineAutocomplete/VInlineAutocomplete.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ const theClearIcon = computed(() => {
226226
const displayValue = computed(() => {
227227
if (modelValue.value && modelValue.value[settings.itemTitle as string]) {
228228
setEmptyValue(false);
229+
229230
return modelValue.value[settings.itemTitle as string];
230231
}
231232
@@ -237,7 +238,7 @@ const displayValue = computed(() => {
237238
return settings.emptyText;
238239
});
239240
240-
function setEmptyValue(val) {
241+
function setEmptyValue(val: boolean) {
241242
empty.value = val;
242243
}
243244

src/plugin/components/VInlineCustomField/VInlineCustomField.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ watch(() => loadingProp.value, (newVal, oldVal) => {
174174
// ------------------------------------------------ The displayed value //
175175
const displayValue = computed(() => {
176176
if (modelValue.value) {
177-
empty.value = false;
177+
setEmptyValue(false);
178178
179179
if (settings.truncateLength) {
180180
return useTruncateText({
@@ -187,10 +187,14 @@ const displayValue = computed(() => {
187187
return modelValue.value;
188188
}
189189
190-
empty.value = true;
190+
setEmptyValue(true);
191191
return settings.emptyText;
192192
});
193193
194+
function setEmptyValue(val: boolean) {
195+
empty.value = val;
196+
}
197+
194198
195199
// ------------------------------------------------ Binding Events & Props //
196200
const slotBindings = computed(() => ({

src/plugin/components/VInlineSelect/VInlineSelect.vue

+7-2
Original file line numberDiff line numberDiff line change
@@ -225,18 +225,23 @@ const theClearIcon = computed(() => {
225225
// ------------------------------------------------ The displayed value //
226226
const displayValue = computed(() => {
227227
if (modelValue.value && modelValue.value[settings.itemTitle as string]) {
228-
empty.value = false;
228+
setEmptyValue(false);
229+
229230
return modelValue.value[settings.itemTitle as string];
230231
}
231232
232233
if (modelValue.value) {
233234
return modelValue.value;
234235
}
235236
236-
empty.value = true;
237+
setEmptyValue(true);
237238
return settings.emptyText;
238239
});
239240
241+
function setEmptyValue(val: boolean) {
242+
empty.value = val;
243+
}
244+
240245
241246
// ------------------------------------------------ Binding Events & Props //
242247
const bindingSettings = computed(() => useBindingSettings(settings));

src/plugin/components/VInlineTextField/VInlineTextField.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ const theClearIcon = computed<string>(() => {
218218
// ------------------------------------------------ The displayed value //
219219
const displayValue = computed(() => {
220220
if (modelValue.value) {
221-
empty.value = false;
221+
setEmptyValue(false);
222222
223223
if (settings.truncateLength) {
224224
return useTruncateText({
@@ -231,10 +231,14 @@ const displayValue = computed(() => {
231231
return modelValue.value;
232232
}
233233
234-
empty.value = true;
234+
setEmptyValue(true);
235235
return settings.emptyText;
236236
});
237237
238+
function setEmptyValue(val: boolean) {
239+
empty.value = val;
240+
}
241+
238242
239243
// ------------------------------------------------ Binding Events & Props //
240244
const bindingSettings = computed(() => useBindingSettings(settings));

src/plugin/components/VInlineTextarea/VInlineTextarea.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ const theClearIcon = computed<string>(() => {
219219
// ------------------------------------------------ The displayed value //
220220
const displayValue = computed(() => {
221221
if (modelValue.value) {
222-
empty.value = false;
222+
setEmptyValue(false);
223223
224224
if (settings.truncateLength) {
225225
return useTruncateText({
@@ -232,10 +232,14 @@ const displayValue = computed(() => {
232232
return modelValue.value;
233233
}
234234
235-
empty.value = true;
235+
setEmptyValue(true);
236236
return settings.emptyText;
237237
});
238238
239+
function setEmptyValue(val: boolean) {
240+
empty.value = val;
241+
}
242+
239243
240244
// ------------------------------------------------ Binding Events & Props //
241245
const bindingSettings = computed(() => useBindingSettings(settings));

0 commit comments

Comments
 (0)