1
0
Fork 0
mirror of synced 2024-09-08 05:31:47 +12:00

Fix issue with deleting rows and fix relationship cells displaying undefined

This commit is contained in:
Andrew Kingston 2023-03-08 10:23:39 +00:00
parent 9020060f17
commit 856f0eb844
2 changed files with 8 additions and 6 deletions

View file

@ -6,9 +6,11 @@
<div class="container">
{#each value || [] as relationship, idx}
<div class="badge" style="--color: {getColor(idx)}">
{relationship.primaryDisplay}
</div>
{#if relationship.primaryDisplay}
<div class="badge" style="--color: {getColor(idx)}">
{relationship.primaryDisplay}
</div>
{/if}
{/each}
</div>

View file

@ -140,7 +140,7 @@ export const createRowsStore = context => {
// Process as either an update, addition or deletion
if (newRow) {
if (index !== -1) {
if (index != null) {
// An existing row was updated
rows.update(state => {
state[index] = { ...newRow }
@ -150,7 +150,7 @@ export const createRowsStore = context => {
// A new row was created
handleNewRows([newRow])
}
} else if (index !== -1) {
} else if (index != null) {
// A row was removed
handleRemoveRows([$rows[index]])
}
@ -171,7 +171,7 @@ export const createRowsStore = context => {
const $rowLookupMap = get(rowLookupMap)
const index = $rowLookupMap[rowId]
const row = $rows[index]
if (index === -1 || row?.[column] === value) {
if (index == null || row?.[column] === value) {
return
}