Skip to content

Commit

Permalink
Fix related value for alias typed fields (directus#9210) (directus#9401)
Browse files Browse the repository at this point in the history
  • Loading branch information
Toilal authored and Armen Danielyan committed Nov 9, 2021
1 parent e0d0436 commit 1106a5c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions app/src/displays/related-values/related-values.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<value-null v-if="!relatedCollection" />
<v-menu
v-else-if="['o2m', 'm2m', 'm2a', 'translations', 'files'].includes(type.toLowerCase())"
v-else-if="['o2m', 'm2m', 'm2a', 'translations', 'files'].includes(localType.toLowerCase())"
show-arrow
:disabled="value.length === 0"
>
Expand Down Expand Up @@ -35,6 +35,7 @@ import { defineComponent, computed, PropType } from 'vue';
import getRelatedCollection from '@/utils/get-related-collection';
import { useCollection } from '@directus/shared/composables';
import ValueNull from '@/views/private/components/value-null';
import { getLocalTypeForField } from '../../modules/settings/routes/data-model/get-local-type';
export default defineComponent({
components: { ValueNull },
Expand All @@ -55,10 +56,6 @@ export default defineComponent({
type: String,
default: null,
},
type: {
type: String,
required: true,
},
},
setup(props) {
const { t, te } = useI18n();
Expand All @@ -67,6 +64,10 @@ export default defineComponent({
return getRelatedCollection(props.collection, props.field);
});
const localType = computed(() => {
return getLocalTypeForField(props.collection, props.field);
});
const { primaryKeyField } = useCollection(relatedCollection);
const internalTemplate = computed(() => {
Expand All @@ -93,7 +94,7 @@ export default defineComponent({
return null;
});
return { relatedCollection, primaryKeyField, getLinkForItem, internalTemplate, unit };
return { relatedCollection, primaryKeyField, getLinkForItem, internalTemplate, unit, localType };
function getLinkForItem(item: any) {
if (!relatedCollection.value || !primaryKeyField.value) return null;
Expand Down

0 comments on commit 1106a5c

Please sign in to comment.