diff --git a/.changeset/short-hairs-beg.md b/.changeset/short-hairs-beg.md new file mode 100644 index 0000000000..87115475d3 --- /dev/null +++ b/.changeset/short-hairs-beg.md @@ -0,0 +1,5 @@ +--- +'@directus/app': patch +--- + +Fixed issue preventing tabular layout from loading when fields are referenced that no longer exist diff --git a/app/src/layouts/tabular/index.ts b/app/src/layouts/tabular/index.ts index d97e0bde65..d987d4f018 100644 --- a/app/src/layouts/tabular/index.ts +++ b/app/src/layouts/tabular/index.ts @@ -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({ .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 [];