@@ -120,7 +120,7 @@ export const ATable = defineComponent({
120
120
return null
121
121
} ) . filter ( i => i ) as [ keyof typeof props , typeof props [ keyof typeof props ] ] [ ]
122
122
123
- return toRefs ( Object . fromEntries ( cardPropsEntries ) )
123
+ return toRefs ( reactive ( Object . fromEntries ( cardPropsEntries ) ) )
124
124
} )
125
125
126
126
// 👉 isSST
@@ -136,6 +136,8 @@ export const ATable = defineComponent({
136
136
137
137
const fetchRows = ( ) => {
138
138
// _search.value, currentPage.value, currentPageSize.value, sortedCols.value
139
+ if ( typeof props . rows !== 'function' )
140
+ return
139
141
140
142
( props . rows as ItemsFunction ) ( {
141
143
/* eslint-disable @typescript-eslint/no-use-before-define */
@@ -163,6 +165,12 @@ export const ATable = defineComponent({
163
165
shallSortByAsc : null ,
164
166
}
165
167
168
+ // 👉 Paginated Rows
169
+ const paginatedRows = ref < any [ ] > ( [ ] )
170
+
171
+ // 👉 rowsToRender
172
+ const rowsToRender = computed ( ( ) => isSST . value ? _serverRows . value : paginatedRows . value )
173
+
166
174
// 👉 _columns
167
175
// TODO: Improve _columns computation
168
176
// If columns are provided via prop
@@ -173,10 +181,9 @@ export const ATable = defineComponent({
173
181
174
182
// Else generate columns from first row
175
183
: isSST . value
176
- /* eslint-disable @typescript-eslint/no-use-before-define */
184
+
177
185
? ( rowsToRender . value . length
178
186
? Object . keys ( rowsToRender . value [ 0 ] )
179
- /* eslint-enable @typescript-eslint/no-use-before-define */
180
187
. map ( k => ( {
181
188
...columnDefaults ,
182
189
name : k ,
@@ -230,9 +237,6 @@ export const ATable = defineComponent({
230
237
} ) ,
231
238
)
232
239
233
- // 👉 Paginated Rows
234
- const paginatedRows = ref < any [ ] > ( [ ] )
235
-
236
240
// TODO: Check passing toRef(props, 'pageSize') to useOffsetPagination and use returned `currentPageSize` for reactive pgeSize prop
237
241
const currentPageSize = ref ( props . pageSize )
238
242
const paginateRows = ( { currentPage, currentPageSize } : { currentPage : number ; currentPageSize : number } ) => {
@@ -275,9 +279,6 @@ export const ATable = defineComponent({
275
279
276
280
watch ( [ _search , sortedCols , sortedRows ] , recalculateCurrentPageData , { deep : true , immediate : true } )
277
281
278
- // 👉 rowsToRender
279
- const rowsToRender = computed ( ( ) => isSST . value ? _serverRows . value : paginatedRows . value )
280
-
281
282
// 👉 onRequest
282
283
// watch([_search, currentPage, sortedCols], fetchRows, { deep: true, immediate: true })
283
284
0 commit comments