@promoboxx/use-filter 1.9.0 → 1.9.1
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/dist/useFilter.d.ts +1 -1
- package/dist/useFilter.js +9 -3
- package/package.json +1 -1
package/dist/useFilter.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export interface FilterApi<TFilter, TResult> {
|
|
|
69
69
|
/**
|
|
70
70
|
* Changes the cursor.
|
|
71
71
|
*/
|
|
72
|
-
setCursor: (cursor: string | null | undefined) => void;
|
|
72
|
+
setCursor: (cursor: string | null | undefined, shouldRunImmediately?: boolean) => void;
|
|
73
73
|
/**
|
|
74
74
|
* Forces a refresh of the filter.
|
|
75
75
|
*/
|
package/dist/useFilter.js
CHANGED
|
@@ -114,11 +114,17 @@ function useFilter(namespace, options) {
|
|
|
114
114
|
extra.offset = offsetNumber;
|
|
115
115
|
extra.page = getPageFromOffset_1.default(offsetNumber, pageSizeNumber);
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
// `null` / `undefined` are valid here, it means there is zero
|
|
118
|
+
// results, so we can't just check if it's truthy, we need to check
|
|
119
|
+
// for presence.
|
|
120
|
+
if ('totalResults' in response.filterInfo) {
|
|
121
|
+
extra.totalResults = Number(totalResults || 0);
|
|
119
122
|
extra.totalPages = Math.ceil(extra.totalResults / pageSizeNumber);
|
|
120
123
|
}
|
|
121
|
-
|
|
124
|
+
// `null` / `undefined` are valid here, it means there is no next
|
|
125
|
+
// cursor, so we can't just check if it's truthy, we need to check
|
|
126
|
+
// for presence.
|
|
127
|
+
if ('nextCursor' in response.filterInfo) {
|
|
122
128
|
extra.nextCursor = nextCursor;
|
|
123
129
|
}
|
|
124
130
|
return __assign(__assign(__assign({}, previous), filterInfoFromResponse), extra);
|