@hyper-fetch/react 9.4.2 → 9.5.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.
Files changed (42) hide show
  1. package/__tests__/features/hydrate/hydrate.spec.tsx +511 -0
  2. package/__tests__/features/hydrate/hydrate.ssr.spec.tsx +189 -0
  3. package/__tests__/features/use-fetch/use-fetch.concurrency.spec.ts +2 -1
  4. package/__tests__/features/use-fetch/use-fetch.methods.spec.ts +9 -3
  5. package/__tests__/features/use-fetch/use-fetch.offline.spec.ts +4 -2
  6. package/__tests__/features/use-fetch/use-fetch.scope.spec.tsx +211 -0
  7. package/__tests__/features/use-fetch/use-fetch.suspense.spec.tsx +223 -0
  8. package/__tests__/features/use-submit/use-submit.methods.spec.ts +9 -3
  9. package/__tests__/features/use-submit/use-submit.optimistic-settlement.spec.ts +625 -0
  10. package/__tests__/features/use-submit/use-submit.optimistic.spec.ts +12 -4
  11. package/__tests__/tsconfig.json +2 -0
  12. package/dist/helpers/use-request-events/use-request-events.hooks.d.ts.map +1 -1
  13. package/dist/helpers/use-tracked-state/use-tracked-state.hooks.d.ts.map +1 -1
  14. package/dist/helpers/use-tracked-state/use-tracked-state.utils.d.ts +4 -1
  15. package/dist/helpers/use-tracked-state/use-tracked-state.utils.d.ts.map +1 -1
  16. package/dist/hooks/use-fetch/use-fetch.hooks.d.ts.map +1 -1
  17. package/dist/hydrate/hydrate.d.ts +16 -0
  18. package/dist/hydrate/hydrate.d.ts.map +1 -0
  19. package/dist/hydrate/hydrate.types.d.ts +52 -0
  20. package/dist/hydrate/hydrate.types.d.ts.map +1 -0
  21. package/dist/hydrate/hydrate.utils.d.ts +19 -0
  22. package/dist/hydrate/hydrate.utils.d.ts.map +1 -0
  23. package/dist/hydrate/index.d.ts +3 -0
  24. package/dist/hydrate/index.d.ts.map +1 -0
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.mjs +229 -44
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/utils/scope.utils.d.ts +7 -0
  30. package/dist/utils/scope.utils.d.ts.map +1 -0
  31. package/package.json +1 -1
  32. package/src/helpers/use-request-events/use-request-events.hooks.ts +24 -33
  33. package/src/helpers/use-tracked-state/use-tracked-state.hooks.ts +8 -3
  34. package/src/helpers/use-tracked-state/use-tracked-state.utils.ts +9 -1
  35. package/src/hooks/use-fetch/use-fetch.hooks.ts +78 -16
  36. package/src/hydrate/hydrate.tsx +74 -0
  37. package/src/hydrate/hydrate.types.ts +55 -0
  38. package/src/hydrate/hydrate.utils.ts +124 -0
  39. package/src/hydrate/index.ts +2 -0
  40. package/src/index.ts +1 -0
  41. package/src/utils/scope.utils.ts +8 -0
  42. package/tsconfig.json +2 -0
@@ -1,5 +1,6 @@
1
1
  import { CacheValueType, NullableType, RequestInstance, ExtractResponseType, ExtractErrorType, ExtractAdapterResolvedType, Dispatcher, ExtractAdapterType, ResponseDetailsType } from '@hyper-fetch/core';
2
2
  import { UseTrackedStateType } from '..';
3
+ import { HydratedEntry } from '../../hydrate/hydrate.types';
3
4
  /**
4
5
  * Determines whether state should be cleared when the cache key changes.
5
6
  *
@@ -19,11 +20,13 @@ export declare const getIsInitiallyLoading: <T extends RequestInstance>({ queryK
19
20
  revalidate?: boolean;
20
21
  disabled?: boolean;
21
22
  }) => boolean;
22
- export declare const getInitialState: <T extends RequestInstance>({ initialResponse, dispatcher, request, disabled, revalidate, }: {
23
+ export declare const getInitialState: <T extends RequestInstance>({ initialResponse, dispatcher, request, disabled, revalidate, hydratedEntry, }: {
23
24
  initialResponse: NullableType<Partial<ExtractAdapterResolvedType<T>>>;
24
25
  dispatcher: Dispatcher<ExtractAdapterType<T>>;
25
26
  request: T;
26
27
  disabled?: boolean;
27
28
  revalidate?: boolean;
29
+ /** Data from the closest `Hydrate` that was not written to the cache yet */
30
+ hydratedEntry?: NullableType<HydratedEntry>;
28
31
  }) => UseTrackedStateType<T>;
29
32
  //# sourceMappingURL=use-tracked-state.utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-tracked-state.utils.d.ts","sourceRoot":"","sources":["../../../src/helpers/use-tracked-state/use-tracked-state.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,EAC1B,UAAU,EACV,kBAAkB,EAElB,mBAAmB,EAGpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAanD;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,MAAM,MAAM,GAAG,UAAU,GAAG,OAAO,EACnC,aAAa,MAAM,EACnB,aAAa,MAAM,KAClB,OAQF,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,QAAQ,mBAAmB,CAAC,eAAe,CAAC,EAC5C,UAAU,OAAO,CAAC,mBAAmB,CAAC,KACrC,mBAYF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,WAAW,MAAM,EAAE,gBAAgB,YAAY,CAAC,IAAI,GAAG,MAAM,CAAC,YAG9F,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,eAAe,EACzD,SAAS,CAAC,EACV,iBAAiB,YAAY,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,EACrE,WAAW,YAAY,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,KAC1G,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,IA0BvF,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,YAAY,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,gBAEnE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,eAAe,EAAE,2DAM9D;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,YASA,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,eAAe,EAAE,iEAMxD;IACD,eAAe,EAAE,YAAY,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,KAAG,mBAAmB,CAAC,CAAC,CAgDxB,CAAC"}
1
+ {"version":3,"file":"use-tracked-state.utils.d.ts","sourceRoot":"","sources":["../../../src/helpers/use-tracked-state/use-tracked-state.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,EAC1B,UAAU,EACV,kBAAkB,EAElB,mBAAmB,EAGpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAa3D;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,MAAM,MAAM,GAAG,UAAU,GAAG,OAAO,EACnC,aAAa,MAAM,EACnB,aAAa,MAAM,KAClB,OAQF,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,QAAQ,mBAAmB,CAAC,eAAe,CAAC,EAC5C,UAAU,OAAO,CAAC,mBAAmB,CAAC,KACrC,mBAYF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,WAAW,MAAM,EAAE,gBAAgB,YAAY,CAAC,IAAI,GAAG,MAAM,CAAC,YAG9F,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,eAAe,EACzD,SAAS,CAAC,EACV,iBAAiB,YAAY,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,EACrE,WAAW,YAAY,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,KAC1G,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,IA0BvF,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,YAAY,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,gBAEnE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,eAAe,EAAE,2DAM9D;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,YASA,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,eAAe,EAAE,gFAOxD;IACD,eAAe,EAAE,YAAY,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;CAC7C,KAAG,mBAAmB,CAAC,CAAC,CAmDxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-fetch.hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-fetch/use-fetch.hooks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EAKf,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAU/E;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,eAAe,EAAE,SAAS,GAAG,mBAAmB,CAAC,CAAC,CAAC,EACpF,SAAS,CAAC,EACV,UAAU,mBAAmB,CAAC,CAAC,EAAE,SAAS,CAAC,KAC1C,kBAAkB,CAAC,CAAC,EAAE,SAAS,CAqWjC,CAAC"}
1
+ {"version":3,"file":"use-fetch.hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-fetch/use-fetch.hooks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,eAAe,EAKf,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AA2B/E;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,eAAe,EAAE,SAAS,GAAG,mBAAmB,CAAC,CAAC,CAAC,EACpF,SAAS,CAAC,EACV,UAAU,mBAAmB,CAAC,CAAC,EAAE,SAAS,CAAC,KAC1C,kBAAkB,CAAC,CAAC,EAAE,SAAS,CAiZjC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { HydrateProps, HydrationContextType } from './hydrate.types';
2
+ /**
3
+ * Hydrates the client cache with data fetched on the server.
4
+ *
5
+ * - Hooks below it render with the hydrated data on the first render, also during server rendering.
6
+ * - On the client the data is written to the cache before the hooks mount, so fresh data is not refetched.
7
+ * - Newer cache data is never replaced by an older snapshot.
8
+ * - It can be nested and rendered conditionally; every `Hydrate` serves only its own client.
9
+ */
10
+ export declare const Hydrate: ({ client, data, options, children }: HydrateProps) => import("react/jsx-runtime").JSX.Element;
11
+ /**
12
+ * Access to the closest hydration data
13
+ * @internal
14
+ */
15
+ export declare const useHydration: () => HydrationContextType | null;
16
+ //# sourceMappingURL=hydrate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../../src/hydrate/hydrate.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAQ1E;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,GAAI,qCAAqC,YAAY,4CA+CxE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,oBAAoB,GAAG,IAEtD,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { CacheValueType, ClientInstance, EmptyTypes, HydrateDataType, HydrationOptions } from '@hyper-fetch/core';
2
+ import { default as React } from 'react';
3
+ /**
4
+ * Options applied to every hydrated item - the same shape as the second argument of `client.hydrate()`
5
+ */
6
+ export type HydrateOptionsType = Partial<HydrationOptions> | ((item: HydrateDataType) => Partial<HydrationOptions>);
7
+ export type HydrateProps = {
8
+ /**
9
+ * Client which cache receives the hydrated data
10
+ */
11
+ client: ClientInstance;
12
+ /**
13
+ * Dehydrated items, usually created on the server with `request.dehydrate()`.
14
+ * Empty values are ignored, so the list can be built conditionally.
15
+ */
16
+ data?: (HydrateDataType | EmptyTypes)[] | EmptyTypes;
17
+ /**
18
+ * Options applied to every item, as an object or a function of the item
19
+ */
20
+ options?: HydrateOptionsType;
21
+ /**
22
+ * Children to render
23
+ */
24
+ children?: React.ReactNode;
25
+ };
26
+ /**
27
+ * Single hydrated item resolved to the value it will have in the cache
28
+ * @internal
29
+ */
30
+ export type HydratedEntry = {
31
+ /** Original item - identity is used to track which items were already written to the cache */
32
+ item: HydrateDataType;
33
+ /** Cache storage key - cacheKey prefixed with the scope */
34
+ storageKey: string;
35
+ /** Value the cache will hold once the item is written */
36
+ value: CacheValueType;
37
+ /** When false, existing cache data is never replaced */
38
+ override: boolean;
39
+ /** Response timestamp used to decide which of the cached and hydrated data is newer */
40
+ timestamp: number;
41
+ };
42
+ /**
43
+ * @internal
44
+ */
45
+ export type HydrationContextType = {
46
+ /**
47
+ * Returns the hydrated entry for the client and storage key,
48
+ * as long as it was not written to the cache yet
49
+ */
50
+ get: (client: ClientInstance, storageKey: string) => HydratedEntry | undefined;
51
+ };
52
+ //# sourceMappingURL=hydrate.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydrate.types.d.ts","sourceRoot":"","sources":["../../src/hydrate/hydrate.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEpH,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,CAAC,eAAe,GAAG,UAAU,CAAC,EAAE,GAAG,UAAU,CAAC;IACrD;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,8FAA8F;IAC9F,IAAI,EAAE,eAAe,CAAC;IACtB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,KAAK,EAAE,cAAc,CAAC;IACtB,wDAAwD;IACxD,QAAQ,EAAE,OAAO,CAAC;IAClB,uFAAuF;IACvF,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,GAAG,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,KAAK,aAAa,GAAG,SAAS,CAAC;CAChF,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { CacheValueType, ClientInstance, EmptyTypes, HydrateDataType, NullableType } from '@hyper-fetch/core';
2
+ import { HydratedEntry, HydrateOptionsType } from './hydrate.types';
3
+ export declare const isConsumed: (client: ClientInstance, item: HydrateDataType) => boolean;
4
+ export declare const markConsumed: (client: ClientInstance, item: HydrateDataType) => void;
5
+ /**
6
+ * Turns dehydrated items into the values they will have in the cache, keyed by storage key.
7
+ * The last item wins when the same key is passed twice.
8
+ */
9
+ export declare const getHydratedEntries: (client: ClientInstance, data: NullableType<(HydrateDataType | EmptyTypes)[]>, options?: HydrateOptionsType) => Map<string, HydratedEntry>;
10
+ /**
11
+ * Decides whether the hydrated value should be used instead of the cached one.
12
+ * Newer data always wins; with `override: false` existing cache data is kept.
13
+ */
14
+ export declare const shouldUseHydratedValue: (cacheData: NullableType<CacheValueType>, entry: HydratedEntry) => boolean;
15
+ /**
16
+ * Picks the data a hook should start with: cached data, unless the hydrated data is newer
17
+ */
18
+ export declare const pickInitialCacheData: <T extends CacheValueType>(cacheData: NullableType<T>, entry: NullableType<HydratedEntry>) => NullableType<T>;
19
+ //# sourceMappingURL=hydrate.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydrate.utils.d.ts","sourceRoot":"","sources":["../../src/hydrate/hydrate.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,UAAU,EACV,eAAe,EAEf,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAkBzE,eAAO,MAAM,UAAU,GAAI,QAAQ,cAAc,EAAE,MAAM,eAAe,YAEvE,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,QAAQ,cAAc,EAAE,MAAM,eAAe,SAEzE,CAAC;AAqBF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,cAAc,EACtB,MAAM,YAAY,CAAC,CAAC,eAAe,GAAG,UAAU,CAAC,EAAE,CAAC,EACpD,UAAU,kBAAkB,KAC3B,GAAG,CAAC,MAAM,EAAE,aAAa,CAiC3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,WAAW,YAAY,CAAC,cAAc,CAAC,EAAE,OAAO,aAAa,KAAG,OAQtG,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,cAAc,EAC3D,WAAW,YAAY,CAAC,CAAC,CAAC,EAC1B,OAAO,YAAY,CAAC,aAAa,CAAC,KACjC,YAAY,CAAC,CAAC,CAKhB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Hydrate } from './hydrate';
2
+ export type { HydrateProps, HydrateOptionsType } from './hydrate.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hydrate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -9,5 +9,6 @@ export * from './hooks/use-app-manager';
9
9
  export * from './hooks/use-is-fetching';
10
10
  export * from './helpers';
11
11
  export * from './provider';
12
+ export * from './hydrate';
12
13
  export * from './utils';
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import React, { useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
2
- import { Request, Time, getRequestDispatcher, replaceEqualDeep, scopeKey, sendRequest } from "@hyper-fetch/core";
1
+ import React, { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
2
+ import { Request, Time, getRequestDispatcher, parseResponse, replaceEqualDeep, scopeKey, sendRequest } from "@hyper-fetch/core";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { getDeliveryKey } from "@hyper-fetch/sockets";
5
5
  //#region ../../node_modules/.pnpm/@better-hooks+lifecycle@2.0.0_react@19.2.5/node_modules/@better-hooks/lifecycle/dist/index.esm.js
@@ -118,6 +118,16 @@ var y = function(n) {
118
118
  };
119
119
  "undefined" == typeof window || void 0 === window.document || window.document.createElement;
120
120
  //#endregion
121
+ //#region src/utils/scope.utils.ts
122
+ /**
123
+ * Core emits request and cache events by the logical (unscoped) keys, while dispatcher queues and cache storage
124
+ * use the scoped keys. Listeners subscribe by the logical key and use this check to skip events of other scopes.
125
+ * @internal
126
+ */
127
+ var isSameScope = (scope, otherScope) => {
128
+ return (scope ?? null) === (otherScope ?? null);
129
+ };
130
+ //#endregion
121
131
  //#region src/helpers/use-request-events/use-request-events.hooks.ts
122
132
  /**
123
133
  * This is helper hook that handles main Hyper-Fetch event/data flow
@@ -159,7 +169,8 @@ var useRequestEvents = ({ request, dispatcher, logger, actions, setCacheData, ge
159
169
  ...values,
160
170
  mutationContext: opt?.context
161
171
  };
162
- if (request.offline && isOffline && !success) {
172
+ const isOfflineError = request.offline && isOffline && !success;
173
+ if (isOfflineError) {
163
174
  logger.debug({
164
175
  title: "Performing offline error callback",
165
176
  type: "system",
@@ -172,9 +183,6 @@ var useRequestEvents = ({ request, dispatcher, logger, actions, setCacheData, ge
172
183
  type: "system",
173
184
  extra: values
174
185
  });
175
- try {
176
- opt?.rollback?.();
177
- } catch {}
178
186
  onAbortCallback.current?.(paramsWithContext);
179
187
  } else if (success) {
180
188
  logger.debug({
@@ -182,7 +190,6 @@ var useRequestEvents = ({ request, dispatcher, logger, actions, setCacheData, ge
182
190
  type: "system",
183
191
  extra: values
184
192
  });
185
- if (opt?.invalidate) opt.invalidate.forEach((req) => cache.invalidate(req));
186
193
  onSuccessCallback.current?.(paramsWithContext);
187
194
  } else {
188
195
  logger.debug({
@@ -190,16 +197,14 @@ var useRequestEvents = ({ request, dispatcher, logger, actions, setCacheData, ge
190
197
  type: "system",
191
198
  extra: values
192
199
  });
193
- if (!willRetry) try {
194
- opt?.rollback?.();
195
- } catch {}
196
200
  onErrorCallback.current?.(paramsWithContext);
197
201
  }
198
202
  onFinishedCallback.current?.(paramsWithContext);
199
- if (!willRetry) optimisticResultsRef.current.delete(values.requestId);
203
+ if (!willRetry && (!isOfflineError || isCanceled)) optimisticResultsRef.current.delete(values.requestId);
200
204
  };
201
205
  const handleGetLoadingEvent = (req) => {
202
- return ({ loading }) => {
206
+ return ({ loading, request: eventRequest }) => {
207
+ if (!isSameScope(eventRequest.scope, req.scope)) return;
203
208
  if (getIsDataProcessing(req.cacheKey)) return;
204
209
  const canDisableLoading = !loading && !dispatcher.hasRunningRequests(scopeKey(req.queryKey, req.scope));
205
210
  if (loading || canDisableLoading) actions.setLoading(loading);
@@ -234,13 +239,7 @@ var useRequestEvents = ({ request, dispatcher, logger, actions, setCacheData, ge
234
239
  };
235
240
  };
236
241
  const handleRemove = ({ requestId }) => {
237
- const opt = optimisticResultsRef.current.get(requestId);
238
- if (opt) {
239
- try {
240
- opt.rollback?.();
241
- } catch {}
242
- optimisticResultsRef.current.delete(requestId);
243
- }
242
+ optimisticResultsRef.current.delete(requestId);
244
243
  removeLifecycleListener(requestId);
245
244
  };
246
245
  const clearCacheDataListener = () => {
@@ -248,8 +247,11 @@ var useRequestEvents = ({ request, dispatcher, logger, actions, setCacheData, ge
248
247
  dataEvents.current = null;
249
248
  };
250
249
  const addCacheDataListener = (req) => {
251
- const loadingUnmount = requestManager.events.onLoadingByQueue(scopeKey(req.queryKey, req.scope), handleGetLoadingEvent(req));
252
- const getResponseUnmount = cache.events.onDataByKey(req.cacheKey, setCacheData);
250
+ const loadingUnmount = requestManager.events.onLoadingByQueue(req.queryKey, handleGetLoadingEvent(req));
251
+ const getResponseUnmount = cache.events.onDataByKey(req.cacheKey, (cacheData) => {
252
+ if (!isSameScope(cacheData.scope, req.scope)) return;
253
+ setCacheData(cacheData);
254
+ });
253
255
  const unmount = () => {
254
256
  loadingUnmount();
255
257
  getResponseUnmount();
@@ -370,6 +372,154 @@ var initialState = {
370
372
  requestTimestamp: null
371
373
  };
372
374
  //#endregion
375
+ //#region src/hydrate/hydrate.utils.ts
376
+ /**
377
+ * Items already written to the cache (or skipped because the cache held newer data), per client.
378
+ * Once an item is consumed the cache is the source of truth, so a hook mounted after `client.clear()`
379
+ * does not get the old server snapshot back.
380
+ */
381
+ var consumedItems = /* @__PURE__ */ new WeakMap();
382
+ var getConsumed = (client) => {
383
+ let consumed = consumedItems.get(client);
384
+ if (!consumed) {
385
+ consumed = /* @__PURE__ */ new WeakSet();
386
+ consumedItems.set(client, consumed);
387
+ }
388
+ return consumed;
389
+ };
390
+ var isConsumed = (client, item) => {
391
+ return getConsumed(client).has(item);
392
+ };
393
+ var markConsumed = (client, item) => {
394
+ getConsumed(client).add(item);
395
+ };
396
+ /**
397
+ * Resolves the config of a single item exactly like `client.hydrate()` does
398
+ */
399
+ var resolveConfig = (item, options) => {
400
+ const { cacheKey, scope, response: _response, ...fallbackOptions } = item;
401
+ const defaults = {
402
+ cache: true,
403
+ override: true
404
+ };
405
+ return {
406
+ ...typeof options === "function" ? {
407
+ ...defaults,
408
+ ...fallbackOptions,
409
+ ...options(item)
410
+ } : {
411
+ ...defaults,
412
+ ...fallbackOptions,
413
+ ...options
414
+ },
415
+ cacheKey,
416
+ scope
417
+ };
418
+ };
419
+ var getResponseTimestamp = (value, fallback = 0) => {
420
+ const timestamp = Number(value?.responseTimestamp);
421
+ return Number.isFinite(timestamp) ? timestamp : fallback;
422
+ };
423
+ /**
424
+ * Turns dehydrated items into the values they will have in the cache, keyed by storage key.
425
+ * The last item wins when the same key is passed twice.
426
+ */
427
+ var getHydratedEntries = (client, data, options) => {
428
+ const entries = /* @__PURE__ */ new Map();
429
+ data?.forEach((item) => {
430
+ if (!item) return;
431
+ const config = resolveConfig(item, options);
432
+ const response = parseResponse(item.response);
433
+ const storageKey = scopeKey(config.cacheKey, config.scope ?? null);
434
+ const value = {
435
+ ...response,
436
+ cacheKey: config.cacheKey,
437
+ scope: config.scope ?? null,
438
+ staleTime: config.staleTime,
439
+ cacheTime: config.cacheTime,
440
+ version: client.cache.version,
441
+ cached: !!config.cache
442
+ };
443
+ entries.set(storageKey, {
444
+ item,
445
+ storageKey,
446
+ value,
447
+ override: config.override !== false,
448
+ timestamp: getResponseTimestamp(response, item.timestamp ?? 0)
449
+ });
450
+ });
451
+ return entries;
452
+ };
453
+ /**
454
+ * Decides whether the hydrated value should be used instead of the cached one.
455
+ * Newer data always wins; with `override: false` existing cache data is kept.
456
+ */
457
+ var shouldUseHydratedValue = (cacheData, entry) => {
458
+ if (!cacheData) return true;
459
+ if (!entry.override) return false;
460
+ return entry.timestamp > getResponseTimestamp(cacheData);
461
+ };
462
+ /**
463
+ * Picks the data a hook should start with: cached data, unless the hydrated data is newer
464
+ */
465
+ var pickInitialCacheData = (cacheData, entry) => {
466
+ if (!entry || !shouldUseHydratedValue(cacheData, entry)) return cacheData;
467
+ return entry.value;
468
+ };
469
+ //#endregion
470
+ //#region src/hydrate/hydrate.tsx
471
+ var HydrationContext = React.createContext(null);
472
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
473
+ /**
474
+ * Hydrates the client cache with data fetched on the server.
475
+ *
476
+ * - Hooks below it render with the hydrated data on the first render, also during server rendering.
477
+ * - On the client the data is written to the cache before the hooks mount, so fresh data is not refetched.
478
+ * - Newer cache data is never replaced by an older snapshot.
479
+ * - It can be nested and rendered conditionally; every `Hydrate` serves only its own client.
480
+ */
481
+ var Hydrate = ({ client, data, options, children }) => {
482
+ const parent = useContext(HydrationContext);
483
+ const entries = useMemo(() => getHydratedEntries(client, data, options), [
484
+ client,
485
+ data,
486
+ options
487
+ ]);
488
+ const entriesRef = useRef(entries);
489
+ entriesRef.current = entries;
490
+ useIsomorphicLayoutEffect(() => {
491
+ if (client.mode === "server") return;
492
+ entries.forEach((entry) => {
493
+ if (isConsumed(client, entry.item)) return;
494
+ markConsumed(client, entry.item);
495
+ if (!shouldUseHydratedValue(client.cache.get(entry.storageKey), entry)) return;
496
+ client.hydrate([entry.item], options);
497
+ });
498
+ }, [
499
+ client,
500
+ entries,
501
+ options
502
+ ]);
503
+ const value = useMemo(() => ({ get: (targetClient, storageKey) => {
504
+ if (targetClient === client) {
505
+ const entry = entriesRef.current.get(storageKey);
506
+ if (entry) return isConsumed(client, entry.item) ? void 0 : entry;
507
+ }
508
+ return parent?.get(targetClient, storageKey);
509
+ } }), [client, parent]);
510
+ return /* @__PURE__ */ jsx(HydrationContext.Provider, {
511
+ value,
512
+ children
513
+ });
514
+ };
515
+ /**
516
+ * Access to the closest hydration data
517
+ * @internal
518
+ */
519
+ var useHydration = () => {
520
+ return useContext(HydrationContext);
521
+ };
522
+ //#endregion
373
523
  //#region src/utils/deep-equal.utils.ts
374
524
  /**
375
525
  * Check if value is empty
@@ -507,10 +657,10 @@ var getIsInitiallyLoading = ({ queryKey, dispatcher, hasState, revalidate, disab
507
657
  const queue = dispatcher.getQueue(queryKey);
508
658
  return dispatcher.hasRunningRequests(queryKey) || !queue.stopped && disabled === false;
509
659
  };
510
- var getInitialState = ({ initialResponse, dispatcher, request, disabled, revalidate }) => {
660
+ var getInitialState = ({ initialResponse, dispatcher, request, disabled, revalidate, hydratedEntry }) => {
511
661
  const { client, cacheKey, unstable_responseMapper } = request;
512
662
  const { cache } = client;
513
- const cacheState = getValidCacheData(request, initialResponse, cache.get(scopeKey(cacheKey, request.scope)));
663
+ const cacheState = getValidCacheData(request, initialResponse, pickInitialCacheData(cache.get(scopeKey(cacheKey, request.scope)), hydratedEntry));
514
664
  const initialLoading = getIsInitiallyLoading({
515
665
  queryKey: scopeKey(request.queryKey, request.scope),
516
666
  dispatcher,
@@ -558,6 +708,7 @@ var getInitialState = ({ initialResponse, dispatcher, request, disabled, revalid
558
708
  var useTrackedState = ({ request, dispatcher, initialResponse, deepCompare, dependencyTracking, keepPreviousData = "auto", disabled, revalidate, select, structuralSharing = true }) => {
559
709
  const { client, cacheKey, queryKey, staleTime, unstable_responseMapper } = request;
560
710
  const { cache } = client;
711
+ const hydration = useHydration();
561
712
  const state = useRef(null);
562
713
  const renderKeys = useRef([]);
563
714
  const isProcessingData = useRef("");
@@ -584,12 +735,16 @@ var useTrackedState = ({ request, dispatcher, initialResponse, deepCompare, depe
584
735
  data: selectData(newState.data, state.current?.data)
585
736
  };
586
737
  };
587
- if (!state.current) state.current = getSelectedState(getInitialState({
588
- initialResponse,
589
- dispatcher,
590
- request,
591
- disabled
592
- }));
738
+ if (!state.current) {
739
+ const hydratedEntry = hydration?.get(client, scopeKey(cacheKey, request.scope));
740
+ state.current = getSelectedState(getInitialState({
741
+ initialResponse,
742
+ dispatcher,
743
+ request,
744
+ disabled,
745
+ hydratedEntry
746
+ }));
747
+ }
593
748
  if (selectError.current) {
594
749
  const { error } = selectError.current;
595
750
  selectError.current = null;
@@ -626,7 +781,7 @@ var useTrackedState = ({ request, dispatcher, initialResponse, deepCompare, depe
626
781
  i(() => {
627
782
  const oldKey = previousCacheKey.current;
628
783
  previousCacheKey.current = cacheKey;
629
- const cacheState = getValidCacheData(request, initialResponse, cache.get(cacheKey));
784
+ const cacheState = getValidCacheData(request, initialResponse, cache.get(scopeKey(cacheKey, request.scope)));
630
785
  if (getShouldClearState(keepPreviousData, oldKey, cacheKey) && !cacheState) {
631
786
  state.current = getSelectedState(getInitialState({
632
787
  initialResponse,
@@ -685,7 +840,7 @@ var useTrackedState = ({ request, dispatcher, initialResponse, deepCompare, depe
685
840
  retries: cacheData.retries,
686
841
  responseTimestamp: new Date(cacheData.responseTimestamp),
687
842
  requestTimestamp: new Date(cacheData.requestTimestamp),
688
- loading: dispatcher.hasRunningRequests(queryKey)
843
+ loading: dispatcher.hasRunningRequests(scopeKey(queryKey, request.scope))
689
844
  };
690
845
  const nextState = { ...state.current };
691
846
  const changedKeys = Object.keys(newStateValues).filter((key) => {
@@ -993,8 +1148,19 @@ var useProvider = () => {
993
1148
  };
994
1149
  //#endregion
995
1150
  //#region src/hooks/use-fetch/use-fetch.hooks.ts
996
- var suspensePromiseMap = /* @__PURE__ */ new Map();
997
- var suspenseResultMap = /* @__PURE__ */ new Map();
1151
+ var suspenseStores = /* @__PURE__ */ new WeakMap();
1152
+ var suspenseFreshTime = 1e3;
1153
+ var getSuspenseStore = (client) => {
1154
+ let store = suspenseStores.get(client);
1155
+ if (!store) {
1156
+ store = {
1157
+ promises: /* @__PURE__ */ new Map(),
1158
+ results: /* @__PURE__ */ new Map()
1159
+ };
1160
+ suspenseStores.set(client, store);
1161
+ }
1162
+ return store;
1163
+ };
998
1164
  /**
999
1165
  * This hook aims to retrieve data from the server. It automatically fetches on mount and
1000
1166
  * refetches based on dependencies, with support for caching, polling, and suspense.
@@ -1019,6 +1185,7 @@ var useFetch = (request, options) => {
1019
1185
  const { cacheKey, queryKey, client } = request;
1020
1186
  const { cache, fetchDispatcher: dispatcher, appManager, loggerManager } = client;
1021
1187
  const ignoreReact18DoubleRender = useRef(true);
1188
+ const resolvedBySuspense = useRef(false);
1022
1189
  const logger = useRef(loggerManager.initialize(client, "useFetch")).current;
1023
1190
  const bounceData = bounceType === "throttle" ? requestThrottle : requestDebounce;
1024
1191
  const bounceFunction = bounceType === "throttle" ? requestThrottle.throttle : requestDebounce.debounce;
@@ -1092,9 +1259,21 @@ var useFetch = (request, options) => {
1092
1259
  handleRefresh();
1093
1260
  };
1094
1261
  const getIsFetchingIdentity = () => {
1095
- return dispatcher.getRunningRequests(queryKey).some((running) => running.request.cacheKey === cacheKey);
1262
+ return dispatcher.getRunningRequests(scopeKey(queryKey, request.scope)).some((running) => running.request.cacheKey === cacheKey);
1263
+ };
1264
+ /**
1265
+ * A suspended component mounts right after its own request resolved - fetching again on mount would
1266
+ * duplicate that request. Data received within the last moment counts as fresh, like the minimal stale time
1267
+ * applied by other suspense-enabled libraries.
1268
+ */
1269
+ const getHasJustResolvedSuspense = () => {
1270
+ if (!suspense) return false;
1271
+ if (resolvedBySuspense.current) return true;
1272
+ const cacheData = cache.get(scopeKey(cacheKey, request.scope));
1273
+ return !!cacheData && Date.now() - cacheData.responseTimestamp < suspenseFreshTime;
1096
1274
  };
1097
1275
  const initialFetchData = () => {
1276
+ if (getHasJustResolvedSuspense()) return;
1098
1277
  const hasStaleData = getStaleStatus();
1099
1278
  const isFetching = getIsFetchingIdentity();
1100
1279
  if ((revalidate || hasStaleData) && !isFetching) handleFetch();
@@ -1191,24 +1370,29 @@ var useFetch = (request, options) => {
1191
1370
  ignoreReact18DoubleRender.current = true;
1192
1371
  });
1193
1372
  if (suspense && !disabled) {
1194
- const suspenseResult = suspenseResultMap.get(cacheKey);
1373
+ const { promises: suspensePromiseMap, results: suspenseResultMap } = getSuspenseStore(client);
1374
+ const suspenseKey = scopeKey(cacheKey, request.scope);
1375
+ const suspenseResult = suspenseResultMap.get(suspenseKey);
1195
1376
  if (suspenseResult) {
1196
- suspenseResultMap.delete(cacheKey);
1377
+ suspenseResultMap.delete(suspenseKey);
1378
+ resolvedBySuspense.current = true;
1197
1379
  if (suspenseResult.data !== null) state.data = selectData(suspenseResult.data);
1198
1380
  if (suspenseResult.error !== null) state.error = suspenseResult.error;
1199
1381
  if (suspenseResult.status !== null) state.status = suspenseResult.status;
1200
1382
  if (suspenseResult.extra !== null) state.extra = suspenseResult.extra;
1201
1383
  state.success = suspenseResult.success;
1384
+ state.loading = dispatcher.hasRunningRequests(scopeKey(queryKey, request.scope));
1202
1385
  }
1203
1386
  if (!(state.data !== null || state.error !== null)) {
1204
- let entry = suspensePromiseMap.get(cacheKey);
1387
+ let entry = suspensePromiseMap.get(suspenseKey);
1205
1388
  if (!entry) {
1206
1389
  let resolvePromise;
1207
1390
  const promise = new Promise((r) => {
1208
1391
  resolvePromise = r;
1209
1392
  });
1210
1393
  const unsubscribe = cache.events.onDataByKey(cacheKey, (cacheData) => {
1211
- suspenseResultMap.set(cacheKey, {
1394
+ if (!isSameScope(cacheData.scope, request.scope)) return;
1395
+ suspenseResultMap.set(suspenseKey, {
1212
1396
  data: cacheData.data ?? null,
1213
1397
  error: cacheData.error ?? null,
1214
1398
  status: cacheData.status ?? null,
@@ -1217,22 +1401,23 @@ var useFetch = (request, options) => {
1217
1401
  });
1218
1402
  resolvePromise();
1219
1403
  unsubscribe();
1220
- suspensePromiseMap.delete(cacheKey);
1404
+ suspensePromiseMap.delete(suspenseKey);
1221
1405
  });
1222
1406
  entry = {
1223
1407
  promise,
1224
1408
  resolve: resolvePromise,
1225
1409
  cleanup: unsubscribe
1226
1410
  };
1227
- suspensePromiseMap.set(cacheKey, entry);
1411
+ suspensePromiseMap.set(suspenseKey, entry);
1228
1412
  }
1229
- if (!dispatcher.hasRunningRequests(queryKey)) dispatcher.add(request);
1413
+ const scopedQueryKey = scopeKey(queryKey, request.scope);
1414
+ if (!dispatcher.hasRunningRequests(scopedQueryKey) && !dispatcher.getIsActiveQueue(scopedQueryKey)) dispatcher.add(request);
1230
1415
  throw entry.promise;
1231
1416
  }
1232
- const entry = suspensePromiseMap.get(cacheKey);
1417
+ const entry = suspensePromiseMap.get(suspenseKey);
1233
1418
  if (entry) {
1234
1419
  entry.cleanup();
1235
- suspensePromiseMap.delete(cacheKey);
1420
+ suspensePromiseMap.delete(suspenseKey);
1236
1421
  }
1237
1422
  }
1238
1423
  if (throwOnError) {
@@ -2093,6 +2278,6 @@ var useIsSubmitting = (client, options) => {
2093
2278
  return useRunningRequestsCount(client.submitDispatcher, options);
2094
2279
  };
2095
2280
  //#endregion
2096
- export { Provider, createTrackedProxy, getBounceData, getDetailsState, getInitialState, getIsInitiallyLoading, getRefreshTime, getShouldClearState, getTimestamp, getValidCacheData, initialSocketState, initialState, isEmpty, isEqual, isStaleCacheData, useAppManager, useCache, useCacheDefaultOptions, useEmitter, useFetch, useFetchDefaultOptions, useIsFetching, useIsSubmitting, useListener, useProvider, useQueue, useQueueDefaultOptions, useRequestEvents, useSocketState, useStream, useSubmit, useSubmitDefaultOptions, useTrackedState };
2281
+ export { Hydrate, Provider, createTrackedProxy, getBounceData, getDetailsState, getInitialState, getIsInitiallyLoading, getRefreshTime, getShouldClearState, getTimestamp, getValidCacheData, initialSocketState, initialState, isEmpty, isEqual, isStaleCacheData, useAppManager, useCache, useCacheDefaultOptions, useEmitter, useFetch, useFetchDefaultOptions, useIsFetching, useIsSubmitting, useListener, useProvider, useQueue, useQueueDefaultOptions, useRequestEvents, useSocketState, useStream, useSubmit, useSubmitDefaultOptions, useTrackedState };
2097
2282
 
2098
2283
  //# sourceMappingURL=index.mjs.map