Skip to content

Commit 7265dbf

Browse files
committed
fix: table row id should not be optional
1 parent 39322f6 commit 7265dbf

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

resources/js/components/cedar-ui/table/TableBase.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,16 @@ onMounted(() => {
9595
<section :class="cn(useGrid || 'flex w-full flex-wrap gap-2', tableStyles)">
9696
<TableLoadingSpinner v-if="loading || pageData?.length === 0" :is-loading="loading" :data-length="pageData?.length" :no-results-message="noResultsMessage" />
9797
<template v-else>
98-
<template v-for="(row, index) in pageData" :key="row?.id ?? index">
98+
<template v-for="(row, index) in pageData" :key="row.id">
9999
<slot name="row" :row="row" :index="index" :selectedID="props.selectedID">
100100
<component
101101
:is="props.row"
102102
:data="row"
103103
:index="index"
104104
:currentID="props.selectedID ?? null"
105105
v-bind="rowAttributes"
106-
@clickAction="(...args: any[]) => props.clickAction?.(row?.id, ...args)"
107-
@otherAction="(...args: any[]) => props.otherAction?.(row?.id, ...args)"
106+
@clickAction="(...args: any[]) => props.clickAction?.(row.id, ...args)"
107+
@otherAction="(...args: any[]) => props.otherAction?.(row.id, ...args)"
108108
></component>
109109
</slot>
110110
</template>

resources/js/components/table/TableBase.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,16 @@ onMounted(() => {
9999
<section :class="cn(useGrid || 'flex w-full flex-wrap gap-2', tableStyles)">
100100
<TableLoadingSpinner v-if="loading || pageData.length === 0" :is-loading="loading" :data-length="pageData.length" :no-results-message="noResultsMessage" />
101101
<template v-else>
102-
<template v-for="(row, index) in pageData" :key="row?.id ?? index">
102+
<template v-for="(row, index) in pageData" :key="row.id">
103103
<slot name="row" :row="row" :index="index" :selectedID="props.selectedID">
104104
<component
105105
:is="props.row"
106106
:data="row"
107107
:index="index"
108108
:currentID="props.selectedID ?? null"
109109
v-bind="rowAttributes"
110-
@clickAction="(...args: any[]) => props.clickAction?.(row?.id, ...args)"
111-
@otherAction="(...args: any[]) => props.otherAction?.(row?.id, ...args)"
110+
@clickAction="(...args: any[]) => props.clickAction?.(row.id, ...args)"
111+
@otherAction="(...args: any[]) => props.otherAction?.(row.id, ...args)"
112112
></component>
113113
</slot>
114114
</template>

0 commit comments

Comments
 (0)