@trackunit/react-graphql-hooks 1.25.3 → 1.25.5

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 CHANGED
@@ -129,7 +129,7 @@ const createPaginationReducer = () => {
129
129
  return { ...state, error: action.payload };
130
130
  }
131
131
  case "RESET": {
132
- return { ...state, data: undefined, lastFetchedData: undefined, error: undefined };
132
+ return { ...state, data: undefined, lastFetchedData: state.lastFetchedData, error: undefined };
133
133
  }
134
134
  case "INCREMENT_RESET_TRIGGER": {
135
135
  return { ...state, resetTrigger: state.resetTrigger + 1 };
@@ -378,10 +378,22 @@ const usePaginationQuery = (document, props) => {
378
378
  onCompleted: completedData => {
379
379
  onCompletedRef.current?.(completedData);
380
380
  },
381
- // This is safe since we have no cache and want to control fetch outselves
382
- fetchPolicy: "standby",
383
- nextFetchPolicy: "standby",
384
- initialFetchPolicy: "standby",
381
+ // This is safe since we have no cache and want to control fetch outselves and if we have a pollInterval we want to use no-cache to avoid stale data.
382
+ fetchPolicy: lazyQueryProps.fetchPolicy !== undefined
383
+ ? lazyQueryProps.fetchPolicy
384
+ : lazyQueryProps.pollInterval !== undefined
385
+ ? "no-cache"
386
+ : "standby",
387
+ nextFetchPolicy: lazyQueryProps.nextFetchPolicy !== undefined
388
+ ? lazyQueryProps.nextFetchPolicy
389
+ : lazyQueryProps.pollInterval !== undefined
390
+ ? "no-cache"
391
+ : "standby",
392
+ initialFetchPolicy: lazyQueryProps.initialFetchPolicy !== undefined
393
+ ? lazyQueryProps.initialFetchPolicy
394
+ : lazyQueryProps.pollInterval !== undefined
395
+ ? "no-cache"
396
+ : "standby",
385
397
  });
386
398
  const executeFetch = react.useCallback((variables, prev, direction) => {
387
399
  if (props.skip) {
package/index.esm.js CHANGED
@@ -127,7 +127,7 @@ const createPaginationReducer = () => {
127
127
  return { ...state, error: action.payload };
128
128
  }
129
129
  case "RESET": {
130
- return { ...state, data: undefined, lastFetchedData: undefined, error: undefined };
130
+ return { ...state, data: undefined, lastFetchedData: state.lastFetchedData, error: undefined };
131
131
  }
132
132
  case "INCREMENT_RESET_TRIGGER": {
133
133
  return { ...state, resetTrigger: state.resetTrigger + 1 };
@@ -376,10 +376,22 @@ const usePaginationQuery = (document, props) => {
376
376
  onCompleted: completedData => {
377
377
  onCompletedRef.current?.(completedData);
378
378
  },
379
- // This is safe since we have no cache and want to control fetch outselves
380
- fetchPolicy: "standby",
381
- nextFetchPolicy: "standby",
382
- initialFetchPolicy: "standby",
379
+ // This is safe since we have no cache and want to control fetch outselves and if we have a pollInterval we want to use no-cache to avoid stale data.
380
+ fetchPolicy: lazyQueryProps.fetchPolicy !== undefined
381
+ ? lazyQueryProps.fetchPolicy
382
+ : lazyQueryProps.pollInterval !== undefined
383
+ ? "no-cache"
384
+ : "standby",
385
+ nextFetchPolicy: lazyQueryProps.nextFetchPolicy !== undefined
386
+ ? lazyQueryProps.nextFetchPolicy
387
+ : lazyQueryProps.pollInterval !== undefined
388
+ ? "no-cache"
389
+ : "standby",
390
+ initialFetchPolicy: lazyQueryProps.initialFetchPolicy !== undefined
391
+ ? lazyQueryProps.initialFetchPolicy
392
+ : lazyQueryProps.pollInterval !== undefined
393
+ ? "no-cache"
394
+ : "standby",
383
395
  });
384
396
  const executeFetch = useCallback((variables, prev, direction) => {
385
397
  if (props.skip) {
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@trackunit/react-graphql-hooks",
3
- "version": "1.25.3",
3
+ "version": "1.25.5",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
7
7
  "node": ">=24.x"
8
8
  },
9
9
  "dependencies": {
10
- "@trackunit/i18n-library-translation": "1.21.3",
11
- "@trackunit/shared-utils": "1.15.1",
10
+ "@trackunit/i18n-library-translation": "1.21.4",
11
+ "@trackunit/shared-utils": "1.15.2",
12
12
  "es-toolkit": "^1.39.10",
13
- "@trackunit/react-components": "1.24.3"
13
+ "@trackunit/react-components": "1.24.4"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@apollo/client": "^3.13.8",