Fix field conditions optionDefaults computed property (#13563)

* fix: remove .value from options

* additional ref fix & type/null errors

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
This commit is contained in:
Yasser Lahbibi
2022-05-26 15:20:31 +02:00
committed by GitHub
parent 44df77a3a0
commit 0a1229bcde

View File

@@ -98,9 +98,9 @@ export default defineComponent({
const optionDefaults = computed(() => {
const selectedInterface = getInterface(interfaceID.value);
if (!selectedInterface) return [];
if (!selectedInterface || !selectedInterface.options) return [];
let optionsObjectOrArray = [];
let optionsObjectOrArray;
if (typeof selectedInterface.options === 'function') {
optionsObjectOrArray = selectedInterface.options({
@@ -108,7 +108,7 @@ export default defineComponent({
type: 'unknown',
},
editing: '+',
collection: collection,
collection: collection.value,
relations: {
o2m: undefined,
m2o: undefined,
@@ -130,7 +130,7 @@ export default defineComponent({
saving: false,
});
} else {
optionsObjectOrArray = selectedInterface.value.options;
optionsObjectOrArray = selectedInterface.options;
}
const optionsArray = Array.isArray(optionsObjectOrArray)
? optionsObjectOrArray