mirror of
https://github.com/directus/directus.git
synced 2026-01-27 09:08:27 -05:00
fix itemId being null (#12799)
This commit is contained in:
@@ -4,7 +4,6 @@ import { unexpectedError } from '@/utils/unexpected-error';
|
||||
import { clamp, cloneDeep, isEqual, merge, isPlainObject } from 'lodash';
|
||||
import { computed, ref, Ref, watch } from 'vue';
|
||||
import { RelationM2A, RelationM2M, RelationO2M } from '@/composables/use-relation';
|
||||
import { Method } from 'axios';
|
||||
|
||||
export type RelationQueryMultiple = {
|
||||
page: number;
|
||||
@@ -318,7 +317,7 @@ export function useRelationMultiple(
|
||||
|
||||
await updateItemCount(targetCollection, targetPKField, reverseJunctionField);
|
||||
|
||||
if (itemId.value === '+') {
|
||||
if (!itemId.value || itemId.value === '+') {
|
||||
fetchedItems.value = [];
|
||||
} else {
|
||||
const response = await api.get(getEndpoint(targetCollection), {
|
||||
@@ -342,7 +341,7 @@ export function useRelationMultiple(
|
||||
}
|
||||
|
||||
async function updateItemCount(targetCollection: string, targetPKField: string, reverseJunctionField: string) {
|
||||
if (itemId.value === '+') {
|
||||
if (!itemId.value || itemId.value === '+') {
|
||||
existingItemCount.value = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ export function useRelationSingle(
|
||||
const id = typeof val === 'object' ? val[relation.value.relatedPrimaryKeyField.field] : val;
|
||||
|
||||
if (!id) {
|
||||
displayItem.value = val;
|
||||
displayItem.value = val as Record<string, any>;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user