mirror of
https://github.com/directus/directus.git
synced 2026-01-29 06:37:56 -05:00
Fix selection of field.meta.special after removal (#10412)
* Set field.meta.special to null when empty * Add check for previously persisted empty string
This commit is contained in:
@@ -376,6 +376,11 @@ export default defineComponent({
|
||||
return null;
|
||||
},
|
||||
set(newOption: string | null) {
|
||||
// In case of previously persisted empty string
|
||||
if (typeof special.value === 'string') {
|
||||
special.value = [];
|
||||
}
|
||||
|
||||
special.value = (special.value ?? []).filter(
|
||||
(special: string) => onCreateSpecials.includes(special) === false
|
||||
);
|
||||
@@ -383,6 +388,11 @@ export default defineComponent({
|
||||
if (newOption) {
|
||||
special.value = [...(special.value ?? []), newOption];
|
||||
}
|
||||
|
||||
// Prevent empty array saved as empty string
|
||||
if (special.value && special.value.length === 0) {
|
||||
special.value = null;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -447,6 +457,11 @@ export default defineComponent({
|
||||
return null;
|
||||
},
|
||||
set(newOption: string | null) {
|
||||
// In case of previously persisted empty string
|
||||
if (typeof special.value === 'string') {
|
||||
special.value = [];
|
||||
}
|
||||
|
||||
special.value = (special.value ?? []).filter(
|
||||
(special: string) => onUpdateSpecials.includes(special) === false
|
||||
);
|
||||
@@ -454,6 +469,11 @@ export default defineComponent({
|
||||
if (newOption) {
|
||||
special.value = [...(special.value ?? []), newOption];
|
||||
}
|
||||
|
||||
// Prevent empty array saved as empty string
|
||||
if (special.value && special.value.length === 0) {
|
||||
special.value = null;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user