rastack 0.0.27 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/hooks/query/list.ts +13 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.29](https://github.com/theserverkid/reactapistack/compare/v0.0.28...v0.0.29) (2026-07-10)
|
|
6
|
+
|
|
7
|
+
### [0.0.28](https://github.com/theserverkid/reactapistack/compare/v0.0.27...v0.0.28) (2026-07-10)
|
|
8
|
+
|
|
5
9
|
### [0.0.27](https://github.com/theserverkid/reactapistack/compare/v0.0.26...v0.0.27) (2026-07-10)
|
|
6
10
|
|
|
7
11
|
### [0.0.26](https://github.com/theserverkid/reactapistack/compare/v0.0.25...v0.0.26) (2026-07-10)
|
package/hooks/query/list.ts
CHANGED
|
@@ -134,8 +134,19 @@ export function useGetPaginatedQueryList<TParam, TResult>({
|
|
|
134
134
|
},
|
|
135
135
|
);
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
// The list envelope is either nested (`{ pagination: { count, last } }`, the
|
|
138
|
+
// Django/DRF-paginated shape) or flat DRF-classic (`{ count, next, previous,
|
|
139
|
+
// results }`, what the in-browser WASM core returns). Support both: prefer the
|
|
140
|
+
// nested fields, else fall back to the top-level `count` and derive the page
|
|
141
|
+
// count from the active page size. Without this, a flat envelope leaves
|
|
142
|
+
// `pageCount`/`itemCount` at 0, which disables paging and hides the total.
|
|
143
|
+
const topLevelCount = (query.data as { count?: number } | undefined)?.count;
|
|
144
|
+
const itemCount = query.data?.pagination?.count ?? topLevelCount ?? 0;
|
|
145
|
+
const pageCount =
|
|
146
|
+
query.data?.pagination?.last ??
|
|
147
|
+
(itemCount
|
|
148
|
+
? Math.max(1, Math.ceil(itemCount / (serverQueryParamState.page_size || 1)))
|
|
149
|
+
: 0);
|
|
139
150
|
|
|
140
151
|
function previousPage() {
|
|
141
152
|
if (queryParamState.page) {
|