File tree Expand file tree Collapse file tree
src/pages/[owner]/[collection]/v Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,14 +49,12 @@ if (tab === "records" && currentType) {
4949 pageSize = 100 ;
5050 offset = (page - 1 ) * pageSize ;
5151 const recordsRes = await fetch (` ${apiBase }/api/collections/${owner }/${collection }/versions/${n }/records?type=${currentType }&limit=${pageSize }&offset=${offset } ` , { headers });
52- records = recordsRes .ok ? await recordsRes .json () : [];
52+ const recordsBody = recordsRes .ok ? await recordsRes .json () : { records: [], pagination: {} };
53+ records = recordsBody .records ?? recordsBody ;
54+ totalRecords = recordsBody .pagination ?.total ?? totalRecords ;
5355
54- // We need the total count for this type — get all records count per type from schema
55- // For now, use the records returned and version.recordCount
56- const allRecordsRes = await fetch (` ${apiBase }/api/collections/${owner }/${collection }/versions/${n }/records?limit=1&offset=0&type=${currentType } ` , { headers });
57- // We'll use the version recordCount as an approximation; for type-specific counts we need to check
58- // Actually, let's fetch a count per type from the full page
59- totalPages = Math .ceil (records .length < pageSize ? 1 : totalRecords / pageSize );
56+ // We need the total count for this type — use pagination.total from the response
57+ totalPages = Math .ceil (totalRecords / pageSize ) || 1 ;
6058
6159 pageNumbers = [];
6260 if (totalPages > 1 ) {
You can’t perform that action at this time.
0 commit comments