mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Filter out any non existent fields (#19352)
* filter out any non existent fields * hide upsi * fix layout throwing error * Format file * Add changeset --------- Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
This commit is contained in:
5
.changeset/short-hairs-beg.md
Normal file
5
.changeset/short-hairs-beg.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@directus/app': patch
|
||||
---
|
||||
|
||||
Fixed issue preventing tabular layout from loading when fields are referenced that no longer exist
|
||||
@@ -11,7 +11,7 @@ import { useCollection, useItems, useSync } from '@directus/composables';
|
||||
import { Field } from '@directus/types';
|
||||
import { defineLayout } from '@directus/utils';
|
||||
import { debounce } from 'lodash';
|
||||
import { computed, ref, toRefs, watch } from 'vue';
|
||||
import { computed, ref, toRefs, unref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import TabularActions from './actions.vue';
|
||||
import TabularOptions from './options.vue';
|
||||
@@ -166,7 +166,18 @@ export default defineLayout<LayoutOptions, LayoutQuery>({
|
||||
.sort();
|
||||
});
|
||||
|
||||
const fields = syncRefProperty(layoutQuery, 'fields', fieldsDefaultValue);
|
||||
const fields = computed({
|
||||
get() {
|
||||
if (layoutQuery.value?.fields) {
|
||||
return layoutQuery.value.fields.filter((field) => fieldsStore.getField(collection.value!, field));
|
||||
} else {
|
||||
return unref(fieldsDefaultValue);
|
||||
}
|
||||
},
|
||||
set(value) {
|
||||
layoutQuery.value.fields = value;
|
||||
},
|
||||
});
|
||||
|
||||
const fieldsWithRelational = computed(() => {
|
||||
if (!props.collection) return [];
|
||||
|
||||
Reference in New Issue
Block a user