@trackunit/react-graphql-hooks 0.0.182 → 0.0.184
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/index.cjs.js +2 -1
- package/index.esm.js +3 -2
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -134,6 +134,7 @@ const unionEdgesByNodeKey = (key, previousEdges, newEdges) => {
|
|
|
134
134
|
* @returns {*} {PaginationQuery}
|
|
135
135
|
*/
|
|
136
136
|
const usePaginationQuery = (document, { ...props }) => {
|
|
137
|
+
var _a;
|
|
137
138
|
const [lastFetchedData, setLastFetchedData] = react.useState();
|
|
138
139
|
const [resetTrigger, setResetTrigger] = react.useState(0);
|
|
139
140
|
// Makes **sure** query variables are stable.
|
|
@@ -170,7 +171,7 @@ const usePaginationQuery = (document, { ...props }) => {
|
|
|
170
171
|
setResetTrigger(prev => prev + 1);
|
|
171
172
|
}, []);
|
|
172
173
|
const { table: { setIsLoading, isLoading, setPageInfo, pageInfo, reset, nextPage, previousPage }, variables: { first, after }, } = reactTablePagination.useRelayPagination({
|
|
173
|
-
pageSize: internalProps.pageSize ||
|
|
174
|
+
pageSize: internalProps.pageSize || ((_a = internalProps.variables) === null || _a === void 0 ? void 0 : _a.first) || reactTablePagination.defaultPageSize,
|
|
174
175
|
onReset,
|
|
175
176
|
});
|
|
176
177
|
const doFetchMore = react.useCallback((variables, prev) => {
|
package/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import 'react/jsx-runtime';
|
|
|
2
2
|
import { registerTranslations } from '@trackunit/i18n-library-translation';
|
|
3
3
|
import { truthy, objectKeys } from '@trackunit/shared-utils';
|
|
4
4
|
import * as ApolloClient from '@apollo/client';
|
|
5
|
-
import { useRelayPagination } from '@trackunit/react-table-pagination';
|
|
5
|
+
import { useRelayPagination, defaultPageSize } from '@trackunit/react-table-pagination';
|
|
6
6
|
import isEqual from 'lodash/isEqual';
|
|
7
7
|
import { useState, useRef, useMemo, useCallback, useEffect } from 'react';
|
|
8
8
|
|
|
@@ -113,6 +113,7 @@ const unionEdgesByNodeKey = (key, previousEdges, newEdges) => {
|
|
|
113
113
|
* @returns {*} {PaginationQuery}
|
|
114
114
|
*/
|
|
115
115
|
const usePaginationQuery = (document, { ...props }) => {
|
|
116
|
+
var _a;
|
|
116
117
|
const [lastFetchedData, setLastFetchedData] = useState();
|
|
117
118
|
const [resetTrigger, setResetTrigger] = useState(0);
|
|
118
119
|
// Makes **sure** query variables are stable.
|
|
@@ -149,7 +150,7 @@ const usePaginationQuery = (document, { ...props }) => {
|
|
|
149
150
|
setResetTrigger(prev => prev + 1);
|
|
150
151
|
}, []);
|
|
151
152
|
const { table: { setIsLoading, isLoading, setPageInfo, pageInfo, reset, nextPage, previousPage }, variables: { first, after }, } = useRelayPagination({
|
|
152
|
-
pageSize: internalProps.pageSize ||
|
|
153
|
+
pageSize: internalProps.pageSize || ((_a = internalProps.variables) === null || _a === void 0 ? void 0 : _a.first) || defaultPageSize,
|
|
153
154
|
onReset,
|
|
154
155
|
});
|
|
155
156
|
const doFetchMore = useCallback((variables, prev) => {
|