From f53664a694f1af0816eee2bc306ccd5c2be28c19 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 26 Sep 2024 13:59:42 +0200 Subject: [PATCH] Fix null references --- .../grid/cells/AttachmentCell.svelte | 24 +++++++++---------- .../frontend-core/src/utils/relatedColumns.js | 4 +++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/frontend-core/src/components/grid/cells/AttachmentCell.svelte b/packages/frontend-core/src/components/grid/cells/AttachmentCell.svelte index 029fdfd726..848ea470dd 100644 --- a/packages/frontend-core/src/components/grid/cells/AttachmentCell.svelte +++ b/packages/frontend-core/src/components/grid/cells/AttachmentCell.svelte @@ -81,19 +81,17 @@ bind:this={anchor} > {#each value || [] as attachment} - {#if attachment} - {#if isImage(attachment.extension)} - {attachment.extension} - {:else} -
- {attachment.extension} -
- {/if} + {#if isImage(attachment.extension)} + {attachment.extension} + {:else} +
+ {attachment.extension} +
{/if} {/each} diff --git a/packages/frontend-core/src/utils/relatedColumns.js b/packages/frontend-core/src/utils/relatedColumns.js index 616b4f4b8c..55f1bbbb00 100644 --- a/packages/frontend-core/src/utils/relatedColumns.js +++ b/packages/frontend-core/src/utils/relatedColumns.js @@ -82,7 +82,9 @@ export function getRelatedTableValues(row, field, fromField) { const parser = columnTypeManyParser[field.type] || (value => value) result = parser( - row[field.related.field].flatMap(r => r[field.related.subField]), + row[field.related.field] + .flatMap(r => r[field.related.subField]) + .filter(i => i !== undefined && i !== null), field )