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"> <div class="container">
{#each value || [] as relationship, idx} {#each value || [] as relationship, idx}
<div class="badge" style="--color: {getColor(idx)}"> {#if relationship.primaryDisplay}
{relationship.primaryDisplay} <div class="badge" style="--color: {getColor(idx)}">
</div> {relationship.primaryDisplay}
</div>
{/if}
{/each} {/each}
</div> </div>

View File

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