@jobber/hooks 2.1.3 → 2.1.4

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.
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.isAlreadyUpdated = exports.useCollectionQuery = void 0;
4
7
  const client_1 = require("@apollo/client");
5
- const lodash_1 = require("lodash");
8
+ const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
6
9
  const react_1 = require("react");
7
10
  const formatters_1 = require("@jobber/formatters");
8
11
  const uniqueNodes_1 = require("./uniqueNodes");
@@ -114,7 +117,7 @@ exports.useCollectionQuery = useCollectionQuery;
114
117
  */
115
118
  function fetchMoreUpdateQueryHandler(prev, fetchMoreResult, getCollectionByPath) {
116
119
  const nextCollection = getCollectionByPath(fetchMoreResult);
117
- const output = (0, lodash_1.cloneDeep)(prev);
120
+ const output = (0, cloneDeep_1.default)(prev);
118
121
  const outputCollection = getCollectionByPath(output);
119
122
  if (outputCollection === undefined || nextCollection === undefined) {
120
123
  return output;
@@ -125,12 +128,12 @@ function fetchMoreUpdateQueryHandler(prev, fetchMoreResult, getCollectionByPath)
125
128
  if (outputCollection.edges && nextCollection.edges) {
126
129
  outputCollection.edges = getUpdatedEdges(outputCollection.edges, nextCollection.edges);
127
130
  }
128
- Object.assign(outputCollection, Object.assign({ pageInfo: (0, lodash_1.cloneDeep)(nextCollection.pageInfo) }, getTotalCount(nextCollection.totalCount)));
131
+ Object.assign(outputCollection, Object.assign({ pageInfo: (0, cloneDeep_1.default)(nextCollection.pageInfo) }, getTotalCount(nextCollection.totalCount)));
129
132
  return output;
130
133
  }
131
134
  function subscribeToMoreHandler(isSearching, prev, getCollectionByPath, subscriptionData, getNodeByPath) {
132
135
  const node = getNodeByPath(subscriptionData);
133
- const output = (0, lodash_1.cloneDeep)(prev);
136
+ const output = (0, cloneDeep_1.default)(prev);
134
137
  const outputCollection = getCollectionByPath(output);
135
138
  if (outputCollection == undefined || node == undefined)
136
139
  return output;
@@ -143,7 +146,7 @@ function subscribeToMoreHandler(isSearching, prev, getCollectionByPath, subscrip
143
146
  if (outputCollection.edges) {
144
147
  outputCollection.edges = getUpdatedEdges(outputCollection.edges, [(0, uniqueEdges_1.createEdge)(node)], false);
145
148
  }
146
- Object.assign(outputCollection, Object.assign({ pageInfo: (0, lodash_1.cloneDeep)(outputCollection.pageInfo) }, getTotalCount(outputCollection.totalCount, 1)));
149
+ Object.assign(outputCollection, Object.assign({ pageInfo: (0, cloneDeep_1.default)(outputCollection.pageInfo) }, getTotalCount(outputCollection.totalCount, 1)));
147
150
  return output;
148
151
  }
149
152
  function getTotalCount(totalCount, additionalCount = 0) {
@@ -8,7 +8,7 @@ const react_1 = require("react");
8
8
  // Importing the polyfilled version of ResizeObserver
9
9
  // eslint-disable-next-line import/no-internal-modules
10
10
  const polyfilled_1 = __importDefault(require("use-resize-observer/polyfilled"));
11
- const lodash_1 = require("lodash");
11
+ const throttle_1 = __importDefault(require("lodash/throttle"));
12
12
  exports.Breakpoints = {
13
13
  base: 640,
14
14
  small: 500,
@@ -22,7 +22,7 @@ function useResizeObserver({ widths = exports.Breakpoints, heights = exports.Bre
22
22
  width: undefined,
23
23
  height: undefined,
24
24
  });
25
- const onResize = (0, react_1.useMemo)(() => (0, lodash_1.throttle)(setSize, wait), [wait]);
25
+ const onResize = (0, react_1.useMemo)(() => (0, throttle_1.default)(setSize, wait), [wait]);
26
26
  const { ref } = (0, polyfilled_1.default)({
27
27
  onResize,
28
28
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/hooks",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -44,5 +44,5 @@
44
44
  "@apollo/client": "^3.0.0",
45
45
  "react": "^18"
46
46
  },
47
- "gitHead": "cffc83c1ccd41849fa2e2ce859aed98a9c587972"
47
+ "gitHead": "c2fde72a97bf0054a5d4d8fe37563b60573b5766"
48
48
  }