@timardex/cluemart-shared 2.0.0 → 2.0.2

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.
@@ -7,7 +7,7 @@ import {
7
7
  SCHOOL_MIN_STUDENT_COUNT,
8
8
  isValidIrdNumber,
9
9
  normalizeUrl
10
- } from "../chunk-L3SNS6OJ.mjs";
10
+ } from "../chunk-XED54CPG.mjs";
11
11
  import {
12
12
  dateFormat,
13
13
  timeFormat
@@ -20,10 +20,10 @@ import {
20
20
  EnumAffiliateParticipantType,
21
21
  EnumPostContentType,
22
22
  EnumPostType
23
- } from "../chunk-JJQL6LZE.mjs";
23
+ } from "../chunk-D45RNLV2.mjs";
24
24
  import "../chunk-RAYUJODN.mjs";
25
25
  import "../chunk-DQ7ZHIXW.mjs";
26
- import "../chunk-XPUYQ7GB.mjs";
26
+ import "../chunk-GRP7XQNB.mjs";
27
27
  import "../chunk-OUWKLNHZ.mjs";
28
28
  import "../chunk-7DQBUZXY.mjs";
29
29
  import {
package/dist/index.cjs CHANGED
@@ -9028,6 +9028,10 @@ function usePaginatedList({
9028
9028
  skip,
9029
9029
  variables: { ...variables, options: { limit: pageSize + 1, offset } }
9030
9030
  });
9031
+ const refetchRef = (0, import_react.useRef)(refetch);
9032
+ refetchRef.current = refetch;
9033
+ const variablesRef = (0, import_react.useRef)(variables);
9034
+ variablesRef.current = variables;
9031
9035
  const rawPage = getItems(data);
9032
9036
  const page = rawPage.length > pageSize ? rawPage.slice(0, pageSize) : rawPage;
9033
9037
  const hasMorePage = rawPage.length > pageSize;
@@ -9052,7 +9056,7 @@ function usePaginatedList({
9052
9056
  return;
9053
9057
  }
9054
9058
  if (error) {
9055
- void refetch();
9059
+ void refetchRef.current();
9056
9060
  return;
9057
9061
  }
9058
9062
  if (!hasSettled) {
@@ -9062,7 +9066,7 @@ function usePaginatedList({
9062
9066
  return;
9063
9067
  }
9064
9068
  setOffset(offset + pageSize);
9065
- }, [loading, skip, error, hasSettled, hasMore, offset, pageSize, refetch]);
9069
+ }, [loading, skip, error, hasSettled, hasMore, offset, pageSize]);
9066
9070
  const refresh = (0, import_react.useCallback)(() => {
9067
9071
  setItems([]);
9068
9072
  setHasMore(!skip);
@@ -9071,11 +9075,11 @@ function usePaginatedList({
9071
9075
  if (skip) {
9072
9076
  return Promise.resolve();
9073
9077
  }
9074
- return refetch({
9075
- ...variables,
9078
+ return refetchRef.current({
9079
+ ...variablesRef.current,
9076
9080
  options: { limit: pageSize + 1, offset: 0 }
9077
9081
  });
9078
- }, [refetch, variables, pageSize, skip]);
9082
+ }, [pageSize, skip]);
9079
9083
  return {
9080
9084
  error,
9081
9085
  hasMore,