@hyper-fetch/react 8.2.0 → 8.2.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.
- package/README.md +17 -7
- package/__tests__/features/helpers/use-request-events/use-request-events.base.spec.ts +1 -1
- package/__tests__/features/helpers/use-request-events/use-request-events.utils.spec.ts +1 -1
- package/__tests__/features/helpers/use-socket-state/use-socket-state.base.spec.ts +3 -3
- package/__tests__/features/helpers/use-tracked-state/use-tacked-state.actions.spec.ts +1 -1
- package/__tests__/features/helpers/use-tracked-state/use-tracked-state.base.spec.ts +55 -55
- package/__tests__/features/helpers/use-tracked-state/use-tracked-state.utils.spec.ts +8 -9
- package/__tests__/features/provider/provider.hydration.spec.tsx +3 -4
- package/__tests__/features/provider/use-config-provider.base.spec.tsx +1 -2
- package/__tests__/features/use-app-manager/use-app-manager.base.spec.ts +1 -1
- package/__tests__/features/use-cache/use-cache.base.spec.ts +6 -6
- package/__tests__/features/use-cache/use-cache.typescript.spec.ts +1 -2
- package/__tests__/features/use-emitter/use-emitter.base.spec.ts +1 -1
- package/__tests__/features/use-fetch/use-fetch.base.spec.ts +13 -9
- package/__tests__/features/use-fetch/use-fetch.cancel.spec.ts +1 -1
- package/__tests__/features/use-fetch/use-fetch.clear-state.spec.ts +1 -1
- package/__tests__/features/use-fetch/use-fetch.concurrency.spec.ts +1 -1
- package/__tests__/features/use-fetch/use-fetch.debounce.spec.ts +1 -1
- package/__tests__/features/use-fetch/use-fetch.integration.spec.tsx +2 -2
- package/__tests__/features/use-fetch/use-fetch.keep-previous-data.spec.ts +1 -1
- package/__tests__/features/use-fetch/use-fetch.methods.spec.ts +1 -1
- package/__tests__/features/use-fetch/use-fetch.offline.spec.ts +1 -1
- package/__tests__/features/use-fetch/use-fetch.prefetch.spec.tsx +2 -2
- package/__tests__/features/use-fetch/use-fetch.refresh.spec.ts +3 -2
- package/__tests__/features/use-fetch/use-fetch.rerender.spec.tsx +3 -3
- package/__tests__/features/use-fetch/use-fetch.revalidate.spec.ts +47 -17
- package/__tests__/features/use-fetch/use-fetch.suspense.spec.tsx +4 -4
- package/__tests__/features/use-fetch/use-fetch.typescript.spec.ts +1 -2
- package/__tests__/features/use-fetch/use-fetch.utils.spec.ts +2 -2
- package/__tests__/features/use-fetch/use-fetch.window.spec.ts +1 -1
- package/__tests__/features/use-listener/use-listener.base.spec.ts +1 -1
- package/__tests__/features/use-queue/use-queue.actions.spec.ts +3 -3
- package/__tests__/features/use-queue/use-queue.base.spec.ts +13 -13
- package/__tests__/features/use-queue/use-queue.resolve.spec.ts +6 -6
- package/__tests__/features/use-stream/use-stream.base.spec.ts +1 -1
- package/__tests__/features/use-submit/use-submit.base.spec.ts +2 -2
- package/__tests__/features/use-submit/use-submit.cancel.spec.ts +1 -1
- package/__tests__/features/use-submit/use-submit.concurrency.spec.ts +1 -1
- package/__tests__/features/use-submit/use-submit.debounce.spec.ts +15 -15
- package/__tests__/features/use-submit/use-submit.methods.spec.ts +1 -1
- package/__tests__/features/use-submit/use-submit.optimistic.spec.ts +1 -1
- package/__tests__/features/use-submit/use-submit.queue.spec.ts +1 -1
- package/__tests__/features/use-submit/use-submit.retry.spec.ts +2 -2
- package/__tests__/features/use-submit/use-submit.revalidate.spec.ts +1 -1
- package/__tests__/features/use-submit/use-submit.submit.spec.ts +1 -1
- package/__tests__/features/use-submit/use-submit.typescript.spec.ts +2 -3
- package/__tests__/shared/isolation.tests.ts +1 -1
- package/__tests__/shared/response.tests.ts +2 -2
- package/__tests__/tsconfig.json +11 -17
- package/__tests__/utils/cache.utils.ts +6 -6
- package/__tests__/utils/use-app-manager.utils.ts +0 -1
- package/__tests__/utils/use-cache.utils.ts +0 -1
- package/__tests__/utils/use-emitter.utils.ts +1 -2
- package/__tests__/utils/use-fetch.utils.ts +0 -1
- package/__tests__/utils/use-listener.utils.ts +1 -2
- package/__tests__/utils/use-queue.utils.ts +4 -5
- package/__tests__/utils/use-request-events.utils.ts +0 -1
- package/__tests__/utils/use-socket-state.utils.ts +1 -2
- package/__tests__/utils/use-submit.utils.ts +0 -1
- package/__tests__/utils/use-tracked-state.utils.ts +0 -1
- package/dist/helpers/use-request-events/use-request-events.hooks.d.ts.map +1 -1
- package/dist/helpers/use-request-events/use-request-events.types.d.ts.map +1 -1
- package/dist/helpers/use-socket-state/use-socket-state.hooks.d.ts.map +1 -1
- package/dist/helpers/use-tracked-state/use-tracked-state.types.d.ts.map +1 -1
- package/dist/helpers/use-tracked-state/use-tracked-state.utils.d.ts.map +1 -1
- package/dist/hooks/use-app-manager/use-app-manager.hooks.d.ts.map +1 -1
- package/dist/hooks/use-cache/use-cache.hooks.d.ts.map +1 -1
- package/dist/hooks/use-cache/use-cache.types.d.ts +2 -2
- package/dist/hooks/use-cache/use-cache.types.d.ts.map +1 -1
- package/dist/hooks/use-emitter/use-emitter.hooks.d.ts.map +1 -1
- package/dist/hooks/use-fetch/use-fetch.constants.d.ts.map +1 -1
- package/dist/hooks/use-fetch/use-fetch.hooks.d.ts.map +1 -1
- package/dist/hooks/use-fetch/use-fetch.types.d.ts.map +1 -1
- package/dist/hooks/use-listener/use-listener.hooks.d.ts.map +1 -1
- package/dist/hooks/use-queue/use-queue.constants.d.ts.map +1 -1
- package/dist/hooks/use-queue/use-queue.hooks.d.ts.map +1 -1
- package/dist/hooks/use-submit/use-submit.hooks.d.ts.map +1 -1
- package/dist/hooks/use-submit/use-submit.types.d.ts +1 -1
- package/dist/hooks/use-submit/use-submit.types.d.ts.map +1 -1
- package/dist/index.mjs +20 -19
- package/dist/index.mjs.map +1 -1
- package/dist/provider/provider.types.d.ts +4 -4
- package/dist/provider/provider.types.d.ts.map +1 -1
- package/dist/utils/bounce.utils.d.ts.map +1 -1
- package/dist/utils/deep-equal.utils.d.ts +2 -2
- package/dist/utils/deep-equal.utils.d.ts.map +1 -1
- package/dist/utils/tracked-proxy.utils.d.ts +1 -1
- package/dist/utils/tracked-proxy.utils.d.ts.map +1 -1
- package/package.json +8 -13
- package/src/helpers/use-request-events/use-request-events.hooks.ts +4 -5
- package/src/helpers/use-request-events/use-request-events.types.ts +0 -1
- package/src/helpers/use-socket-state/use-socket-state.hooks.ts +5 -6
- package/src/helpers/use-tracked-state/use-tracked-state.hooks.ts +11 -11
- package/src/helpers/use-tracked-state/use-tracked-state.types.ts +0 -1
- package/src/helpers/use-tracked-state/use-tracked-state.utils.ts +12 -13
- package/src/hooks/use-app-manager/use-app-manager.hooks.ts +1 -2
- package/src/hooks/use-cache/use-cache.hooks.ts +3 -4
- package/src/hooks/use-cache/use-cache.types.ts +2 -3
- package/src/hooks/use-emitter/use-emitter.hooks.ts +3 -4
- package/src/hooks/use-fetch/use-fetch.constants.ts +0 -1
- package/src/hooks/use-fetch/use-fetch.hooks.ts +12 -9
- package/src/hooks/use-fetch/use-fetch.types.ts +0 -1
- package/src/hooks/use-listener/use-listener.hooks.ts +2 -3
- package/src/hooks/use-queue/use-queue.constants.ts +0 -1
- package/src/hooks/use-queue/use-queue.hooks.ts +1 -2
- package/src/hooks/use-stream/use-stream.hooks.ts +4 -4
- package/src/hooks/use-submit/use-submit.hooks.ts +5 -6
- package/src/hooks/use-submit/use-submit.types.ts +1 -2
- package/src/provider/provider.types.ts +4 -5
- package/src/utils/bounce.utils.ts +1 -0
- package/src/utils/deep-equal.utils.ts +28 -12
- package/src/utils/tracked-proxy.utils.ts +1 -1
- package/tsconfig.json +11 -2
- package/vite.config.ts +14 -20
- package/.eslintrc.cjs +0 -12
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RequestInstance } from '@hyper-fetch/core';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
import { UseSubmitOptionsType } from '../hooks/use-submit';
|
|
4
2
|
import { UseCacheOptionsType } from '../hooks/use-cache';
|
|
5
|
-
import { UseQueueOptionsType } from '../hooks/use-queue';
|
|
6
|
-
import { UseListenerOptionsType } from '../hooks/use-listener';
|
|
7
3
|
import { UseEmitterOptionsType } from '../hooks/use-emitter';
|
|
8
4
|
import { UseFetchOptionsType } from '../hooks/use-fetch';
|
|
5
|
+
import { UseListenerOptionsType } from '../hooks/use-listener';
|
|
6
|
+
import { UseQueueOptionsType } from '../hooks/use-queue';
|
|
7
|
+
import { UseSubmitOptionsType } from '../hooks/use-submit';
|
|
8
|
+
import { default as React } from 'react';
|
|
9
9
|
export type ProviderOptionsType = {
|
|
10
10
|
useFetchConfig?: Partial<UseFetchOptionsType<RequestInstance>>;
|
|
11
11
|
useSubmitConfig?: Partial<UseSubmitOptionsType<RequestInstance>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.types.d.ts","sourceRoot":"","sources":["../../src/provider/provider.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"provider.types.d.ts","sourceRoot":"","sources":["../../src/provider/provider.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC;IAC/D,eAAe,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC,CAAC;IACjE,cAAc,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC;IAC/D,cAAc,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,CAAC,SAAS,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACrD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounce.utils.d.ts","sourceRoot":"","sources":["../../src/utils/bounce.utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,YAAY;IACxC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,KAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"bounce.utils.d.ts","sourceRoot":"","sources":["../../src/utils/bounce.utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,YAAY;IACxC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,KAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAMvC,CAAC"}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* @param value any object or primitive
|
|
4
4
|
* @returns true when value is empty
|
|
5
5
|
*/
|
|
6
|
-
export declare const isEmpty: (value
|
|
6
|
+
export declare const isEmpty: (value?: unknown) => boolean;
|
|
7
7
|
/**
|
|
8
8
|
* Allow to deep compare any passed values
|
|
9
9
|
* @param firstValue unknown
|
|
10
10
|
* @param secondValue unknown
|
|
11
11
|
* @returns true when elements are equal
|
|
12
12
|
*/
|
|
13
|
-
export declare const isEqual: (firstValue
|
|
13
|
+
export declare const isEqual: (firstValue?: unknown, secondValue?: unknown) => boolean;
|
|
14
14
|
//# sourceMappingURL=deep-equal.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-equal.utils.d.ts","sourceRoot":"","sources":["../../src/utils/deep-equal.utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,
|
|
1
|
+
{"version":3,"file":"deep-equal.utils.d.ts","sourceRoot":"","sources":["../../src/utils/deep-equal.utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,OAAO,KAAG,OASzC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,aAAa,OAAO,EAAE,cAAc,OAAO,KAAG,OA8DrE,CAAC"}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Unlike getter-based tracking, Proxy-wrapped objects display their actual values in console.log,
|
|
4
4
|
* making debugging significantly easier while preserving field-level dependency tracking.
|
|
5
5
|
*/
|
|
6
|
-
export declare const createTrackedProxy: <T extends Record<string, unknown>, K extends string>(target: T, trackedKeys:
|
|
6
|
+
export declare const createTrackedProxy: <T extends Record<string, unknown>, K extends string>(target: T, trackedKeys: readonly K[], setRenderKey: (key: K) => void) => T;
|
|
7
7
|
//# sourceMappingURL=tracked-proxy.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracked-proxy.utils.d.ts","sourceRoot":"","sources":["../../src/utils/tracked-proxy.utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,SAAS,MAAM,EACpF,QAAQ,CAAC,EACT,aAAa,
|
|
1
|
+
{"version":3,"file":"tracked-proxy.utils.d.ts","sourceRoot":"","sources":["../../src/utils/tracked-proxy.utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,SAAS,MAAM,EACpF,QAAQ,CAAC,EACT,aAAa,SAAS,CAAC,EAAE,EACzB,cAAc,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,KAC7B,CASF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyper-fetch/react",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.2",
|
|
4
4
|
"description": "React hooks and utils for the hyper-fetch",
|
|
5
5
|
"author": "Maciej Pyrc <maciekpyrc@gmail.com>, Kacper Skawina <kacper.skawina@gmail.com>",
|
|
6
6
|
"homepage": "https://hyperfetch.bettertyped.com/",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"test": "vitest run",
|
|
26
|
-
"start": "
|
|
26
|
+
"start": "pnpm build && npx run-when-changed --watch 'src/**/*.ts' --exec 'pnpm build'",
|
|
27
27
|
"build": "vite build",
|
|
28
|
-
"lint": "
|
|
29
|
-
"format": "
|
|
30
|
-
"typecheck": "
|
|
31
|
-
"tests": "
|
|
32
|
-
"release": "
|
|
28
|
+
"lint": "oxlint .",
|
|
29
|
+
"format": "oxfmt --write .",
|
|
30
|
+
"typecheck": "tsgo --noEmit --emitDeclarationOnly false && tsgo --noEmit -p __tests__/tsconfig.json",
|
|
31
|
+
"tests": "pnpm lint-staged",
|
|
32
|
+
"release": "pnpm semantic-release --extends ../../release.config.js -t 'react-hyper-fetch-v${version}'"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@hyper-fetch/core": "*",
|
|
@@ -50,14 +50,9 @@
|
|
|
50
50
|
"vitest related --run --passWithNoTests"
|
|
51
51
|
]
|
|
52
52
|
},
|
|
53
|
-
"eslintConfig": {
|
|
54
|
-
"extends": [
|
|
55
|
-
"react"
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
53
|
"publishConfig": {
|
|
59
54
|
"access": "public",
|
|
60
|
-
"registry": "https://registry.npmjs.
|
|
55
|
+
"registry": "https://registry.npmjs.org/"
|
|
61
56
|
},
|
|
62
57
|
"repository": {
|
|
63
58
|
"type": "git",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useWillUnmount } from "@better-hooks/lifecycle";
|
|
1
2
|
import type {
|
|
2
3
|
ExtractErrorType,
|
|
3
4
|
ExtractResponseType,
|
|
@@ -11,9 +12,6 @@ import type {
|
|
|
11
12
|
OptimisticCallbackResult,
|
|
12
13
|
} from "@hyper-fetch/core";
|
|
13
14
|
import { scopeKey } from "@hyper-fetch/core";
|
|
14
|
-
import { useWillUnmount } from "@better-hooks/lifecycle";
|
|
15
|
-
import { useRef } from "react";
|
|
16
|
-
|
|
17
15
|
import type {
|
|
18
16
|
OnErrorCallbackType,
|
|
19
17
|
OnStartCallbackType,
|
|
@@ -25,6 +23,7 @@ import type {
|
|
|
25
23
|
UseRequestEventsPropsType,
|
|
26
24
|
UseRequestEventsLifecycleMap,
|
|
27
25
|
} from "helpers";
|
|
26
|
+
import { useRef } from "react";
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
* This is helper hook that handles main Hyper-Fetch event/data flow
|
|
@@ -73,7 +72,7 @@ export const useRequestEvents = <R extends RequestInstance>({
|
|
|
73
72
|
|
|
74
73
|
const clearLifecycleListeners = () => {
|
|
75
74
|
const events = lifecycleEvents.current;
|
|
76
|
-
const listeners =
|
|
75
|
+
const listeners = [...events.values()];
|
|
77
76
|
listeners.forEach((value) => {
|
|
78
77
|
value.unmount();
|
|
79
78
|
});
|
|
@@ -140,7 +139,7 @@ export const useRequestEvents = <R extends RequestInstance>({
|
|
|
140
139
|
|
|
141
140
|
// When we process the cache data, we don't want to change the loading state during it
|
|
142
141
|
// This prevents the UI from flickering with { data: null, loading: false }
|
|
143
|
-
if (isProcessing) return;
|
|
142
|
+
if (isProcessing) {return;}
|
|
144
143
|
|
|
145
144
|
const canDisableLoading = !loading && !dispatcher.hasRunningRequests(scopeKey(req.queryKey, req.scope));
|
|
146
145
|
if (loading || canDisableLoading) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { SocketInstance, ExtractSocketExtraType } from "@hyper-fetch/sockets";
|
|
2
1
|
import { useDidMount, useDidUpdate } from "@better-hooks/lifecycle";
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import type { SocketInstance, ExtractSocketExtraType } from "@hyper-fetch/sockets";
|
|
5
3
|
import type { UseSocketStateType, UseSocketStateProps } from "helpers";
|
|
4
|
+
import { useCallback, useRef, useSyncExternalStore } from "react";
|
|
6
5
|
|
|
7
6
|
export const useSocketState = <DataType, Socket extends SocketInstance>(
|
|
8
7
|
socket: Socket,
|
|
@@ -22,7 +21,7 @@ export const useSocketState = <DataType, Socket extends SocketInstance>(
|
|
|
22
21
|
connecting: socket.adapter.connecting,
|
|
23
22
|
timestamp: null,
|
|
24
23
|
});
|
|
25
|
-
const renderKeys = useRef<
|
|
24
|
+
const renderKeys = useRef<(keyof UseSocketStateType<Socket, DataType>)[]>([]);
|
|
26
25
|
|
|
27
26
|
// ******************
|
|
28
27
|
// useSyncExternalStore
|
|
@@ -51,9 +50,9 @@ export const useSocketState = <DataType, Socket extends SocketInstance>(
|
|
|
51
50
|
// Dependency Tracking
|
|
52
51
|
// ******************
|
|
53
52
|
|
|
54
|
-
const renderKeyTrigger = (keys:
|
|
53
|
+
const renderKeyTrigger = (keys: (keyof UseSocketStateType<Socket, DataType>)[]) => {
|
|
55
54
|
const shouldRerender = renderKeys.current.some((renderKey) => keys.includes(renderKey));
|
|
56
|
-
if (shouldRerender) emitChange();
|
|
55
|
+
if (shouldRerender) {emitChange();}
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
const setRenderKey = (renderKey: keyof UseSocketStateType<Socket, DataType>) => {
|
|
@@ -11,8 +11,8 @@ import type {
|
|
|
11
11
|
} from "@hyper-fetch/core";
|
|
12
12
|
import { scopeKey } from "@hyper-fetch/core";
|
|
13
13
|
import { useCallback, useRef, useSyncExternalStore } from "react";
|
|
14
|
-
|
|
15
14
|
import { isEqual } from "utils";
|
|
15
|
+
|
|
16
16
|
import type {
|
|
17
17
|
UseTrackedStateActions,
|
|
18
18
|
UseTrackedStateType,
|
|
@@ -49,7 +49,7 @@ export const useTrackedState = <T extends RequestInstance>({
|
|
|
49
49
|
const { cache } = client;
|
|
50
50
|
|
|
51
51
|
const state = useRef<UseTrackedStateType<T>>(getInitialState({ initialResponse, dispatcher, request, disabled }));
|
|
52
|
-
const renderKeys = useRef<
|
|
52
|
+
const renderKeys = useRef<(keyof UseTrackedStateType<T>)[]>([]);
|
|
53
53
|
const isProcessingData = useRef("");
|
|
54
54
|
const previousCacheKey = useRef(cacheKey);
|
|
55
55
|
|
|
@@ -89,9 +89,9 @@ export const useTrackedState = <T extends RequestInstance>({
|
|
|
89
89
|
// Dependency Tracking
|
|
90
90
|
// ******************
|
|
91
91
|
|
|
92
|
-
const renderKeyTrigger = (keys:
|
|
92
|
+
const renderKeyTrigger = (keys: (keyof UseTrackedStateType)[]) => {
|
|
93
93
|
const shouldRerender = renderKeys.current.some((renderKey) => keys.includes(renderKey));
|
|
94
|
-
if (shouldRerender) emitChange();
|
|
94
|
+
if (shouldRerender) {emitChange();}
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
const setRenderKey = (renderKey: keyof UseTrackedStateType) => {
|
|
@@ -264,37 +264,37 @@ export const useTrackedState = <T extends RequestInstance>({
|
|
|
264
264
|
},
|
|
265
265
|
setLoading: (loading) => {
|
|
266
266
|
const value = loading instanceof Function ? loading(state.current.loading) : loading;
|
|
267
|
-
if (value === state.current.loading) return;
|
|
267
|
+
if (value === state.current.loading) {return;}
|
|
268
268
|
state.current.loading = value;
|
|
269
269
|
renderKeyTrigger(["loading"]);
|
|
270
270
|
},
|
|
271
271
|
setStatus: (status) => {
|
|
272
272
|
const value = status instanceof Function ? status(state.current.status) : status;
|
|
273
|
-
if (value === state.current.status) return;
|
|
273
|
+
if (value === state.current.status) {return;}
|
|
274
274
|
state.current.status = status instanceof Function ? status(state.current.status || null) : status;
|
|
275
275
|
renderKeyTrigger(["status"]);
|
|
276
276
|
},
|
|
277
277
|
setSuccess: (success) => {
|
|
278
278
|
const value = success instanceof Function ? success(state.current.success || false) : success;
|
|
279
|
-
if (value === state.current.success) return;
|
|
279
|
+
if (value === state.current.success) {return;}
|
|
280
280
|
state.current.success = success instanceof Function ? success(state.current.success || false) : success;
|
|
281
281
|
renderKeyTrigger(["success"]);
|
|
282
282
|
},
|
|
283
283
|
setExtra: (extra) => {
|
|
284
284
|
const value = extra instanceof Function ? extra(state.current.extra) : extra;
|
|
285
|
-
if (value === state.current.extra) return;
|
|
285
|
+
if (value === state.current.extra) {return;}
|
|
286
286
|
state.current.extra = extra instanceof Function ? extra(state.current.extra) : extra;
|
|
287
287
|
renderKeyTrigger(["extra"]);
|
|
288
288
|
},
|
|
289
289
|
setRetries: (retries) => {
|
|
290
290
|
const value = retries instanceof Function ? retries(state.current.retries || 0) : retries;
|
|
291
|
-
if (value === state.current.retries) return;
|
|
291
|
+
if (value === state.current.retries) {return;}
|
|
292
292
|
state.current.retries = retries instanceof Function ? retries(state.current.retries || 0) : retries;
|
|
293
293
|
renderKeyTrigger(["retries"]);
|
|
294
294
|
},
|
|
295
295
|
setResponseTimestamp: (timestamp) => {
|
|
296
296
|
const value = timestamp instanceof Function ? timestamp(state.current.responseTimestamp) : timestamp;
|
|
297
|
-
if (value === state.current.responseTimestamp) return;
|
|
297
|
+
if (value === state.current.responseTimestamp) {return;}
|
|
298
298
|
const getTimestamp = (prev: Date | null) => {
|
|
299
299
|
return timestamp instanceof Function ? timestamp(prev ? new Date(prev) : null) : timestamp;
|
|
300
300
|
};
|
|
@@ -304,7 +304,7 @@ export const useTrackedState = <T extends RequestInstance>({
|
|
|
304
304
|
},
|
|
305
305
|
setRequestTimestamp: (timestamp) => {
|
|
306
306
|
const value = timestamp instanceof Function ? timestamp(state.current.requestTimestamp) : timestamp;
|
|
307
|
-
if (value === state.current.requestTimestamp) return;
|
|
307
|
+
if (value === state.current.requestTimestamp) {return;}
|
|
308
308
|
const getTimestamp = (prev: Date | null) => {
|
|
309
309
|
return timestamp instanceof Function ? timestamp(prev ? new Date(prev) : null) : timestamp;
|
|
310
310
|
};
|
|
@@ -14,7 +14,6 @@ import type {
|
|
|
14
14
|
ResponseType,
|
|
15
15
|
} from "@hyper-fetch/core";
|
|
16
16
|
import { scopeKey } from "@hyper-fetch/core";
|
|
17
|
-
|
|
18
17
|
import type { UseTrackedStateType } from "helpers";
|
|
19
18
|
import { initialState } from "helpers";
|
|
20
19
|
|
|
@@ -24,7 +23,7 @@ import { initialState } from "helpers";
|
|
|
24
23
|
*/
|
|
25
24
|
const getCacheKeyIdentity = (cacheKey: string): string => {
|
|
26
25
|
const lastUnderscoreIndex = cacheKey.lastIndexOf("_");
|
|
27
|
-
if (lastUnderscoreIndex === -1) return cacheKey;
|
|
26
|
+
if (lastUnderscoreIndex === -1) {return cacheKey;}
|
|
28
27
|
return cacheKey.substring(0, lastUnderscoreIndex);
|
|
29
28
|
};
|
|
30
29
|
|
|
@@ -40,10 +39,10 @@ export const getShouldClearState = (
|
|
|
40
39
|
oldCacheKey: string,
|
|
41
40
|
newCacheKey: string,
|
|
42
41
|
): boolean => {
|
|
43
|
-
if (oldCacheKey === newCacheKey) return false;
|
|
42
|
+
if (oldCacheKey === newCacheKey) {return false;}
|
|
44
43
|
|
|
45
|
-
if (mode === "clean") return true;
|
|
46
|
-
if (mode === "preserve") return false;
|
|
44
|
+
if (mode === "clean") {return true;}
|
|
45
|
+
if (mode === "preserve") {return false;}
|
|
47
46
|
|
|
48
47
|
// "auto" — compare the identity part (method + endpoint with params)
|
|
49
48
|
return getCacheKeyIdentity(oldCacheKey) !== getCacheKeyIdentity(newCacheKey);
|
|
@@ -58,17 +57,17 @@ export const getDetailsState = (
|
|
|
58
57
|
isCanceled: false,
|
|
59
58
|
isOffline: false,
|
|
60
59
|
willRetry: false,
|
|
61
|
-
addedTimestamp:
|
|
62
|
-
triggerTimestamp:
|
|
63
|
-
requestTimestamp:
|
|
64
|
-
responseTimestamp:
|
|
60
|
+
addedTimestamp: Date.now(),
|
|
61
|
+
triggerTimestamp: Date.now(),
|
|
62
|
+
requestTimestamp: Date.now(),
|
|
63
|
+
responseTimestamp: Date.now(),
|
|
65
64
|
...details,
|
|
66
65
|
};
|
|
67
66
|
};
|
|
68
67
|
|
|
69
68
|
export const isStaleCacheData = (staleTime: number, staleTimestamp: NullableType<Date | number>) => {
|
|
70
|
-
if (!staleTimestamp) return true;
|
|
71
|
-
return
|
|
69
|
+
if (!staleTimestamp) {return true;}
|
|
70
|
+
return Date.now() > +staleTimestamp + staleTime;
|
|
72
71
|
};
|
|
73
72
|
|
|
74
73
|
export const getValidCacheData = <T extends RequestInstance>(
|
|
@@ -95,8 +94,8 @@ export const getValidCacheData = <T extends RequestInstance>(
|
|
|
95
94
|
cacheKey: request.cacheKey,
|
|
96
95
|
scope: request.scope,
|
|
97
96
|
cacheTime: request.cacheTime,
|
|
98
|
-
requestTimestamp: initialResponse?.requestTimestamp ??
|
|
99
|
-
responseTimestamp: initialResponse?.responseTimestamp ??
|
|
97
|
+
requestTimestamp: initialResponse?.requestTimestamp ?? Date.now(),
|
|
98
|
+
responseTimestamp: initialResponse?.responseTimestamp ?? Date.now(),
|
|
100
99
|
};
|
|
101
100
|
}
|
|
102
101
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useDidMount } from "@better-hooks/lifecycle";
|
|
2
2
|
import type { ClientInstance } from "@hyper-fetch/core";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
|
|
5
3
|
import type { UseAppManagerReturnType } from "hooks/use-app-manager";
|
|
4
|
+
import { useState } from "react";
|
|
6
5
|
|
|
7
6
|
/** Track the application's online/offline and focus/blur state through the client's AppManager. */
|
|
8
7
|
export const useAppManager = <Client extends ClientInstance>(client: Client): UseAppManagerReturnType => {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { useDidUpdate } from "@better-hooks/lifecycle";
|
|
2
2
|
import type { RequestInstance } from "@hyper-fetch/core";
|
|
3
3
|
import { getRequestDispatcher } from "@hyper-fetch/core";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { useRequestEvents, useTrackedState } from "helpers";
|
|
6
5
|
import type { UseCacheOptionsType, UseCacheReturnType } from "hooks/use-cache";
|
|
7
6
|
import { useCacheDefaultOptions } from "hooks/use-cache";
|
|
8
|
-
import { useRequestEvents, useTrackedState } from "helpers";
|
|
9
7
|
import { useProvider } from "provider";
|
|
8
|
+
import { useRef } from "react";
|
|
10
9
|
import { createTrackedProxy } from "utils";
|
|
11
10
|
|
|
12
11
|
/** Subscribe to cache updates for a given request without triggering network activity. */
|
|
@@ -72,7 +71,7 @@ export const useCache = <T extends RequestInstance>(
|
|
|
72
71
|
true,
|
|
73
72
|
);
|
|
74
73
|
|
|
75
|
-
const invalidate = (cacheKeys?: string | RegExp | RequestInstance |
|
|
74
|
+
const invalidate = (cacheKeys?: string | RegExp | RequestInstance | (string | RegExp | RequestInstance)[]) => {
|
|
76
75
|
cache.invalidate(cacheKeys ?? cacheKey);
|
|
77
76
|
};
|
|
78
77
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { RequestInstance, ExtractResponseType, ExtractErrorType, CacheValueType } from "@hyper-fetch/core";
|
|
2
|
-
|
|
3
|
-
import type { isEqual } from "utils";
|
|
4
2
|
import type { UseTrackedStateActions, UseTrackedStateType } from "helpers";
|
|
3
|
+
import type { isEqual } from "utils";
|
|
5
4
|
|
|
6
5
|
export type UseCacheOptionsType<T extends RequestInstance> = {
|
|
7
6
|
/**
|
|
@@ -23,5 +22,5 @@ export type UseCacheReturnType<T extends RequestInstance> = UseTrackedStateType<
|
|
|
23
22
|
/**
|
|
24
23
|
* Invalidate cache for the current request or pass custom key to trigger it by invalidationKey(Regex / cacheKey).
|
|
25
24
|
*/
|
|
26
|
-
invalidate: (cacheKeys?: string | RegExp | RequestInstance |
|
|
25
|
+
invalidate: (cacheKeys?: string | RegExp | RequestInstance | (string | RegExp | RequestInstance)[]) => void;
|
|
27
26
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { EmitterInstance, EmitterCallbackErrorType, EmitType } from "@hyper-fetch/sockets";
|
|
2
1
|
import { useDidUpdate } from "@better-hooks/lifecycle";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import type { UseEmitterOptionsType } from "hooks/use-emitter";
|
|
2
|
+
import type { EmitterInstance, EmitterCallbackErrorType, EmitType } from "@hyper-fetch/sockets";
|
|
6
3
|
import { useSocketState } from "helpers";
|
|
4
|
+
import type { UseEmitterOptionsType } from "hooks/use-emitter";
|
|
7
5
|
import { useProvider } from "provider";
|
|
6
|
+
import { useRef } from "react";
|
|
8
7
|
import { createTrackedProxy } from "utils";
|
|
9
8
|
|
|
10
9
|
/** Send messages through a socket emitter with tracked connection state and lifecycle callbacks. */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { RequestInstance, RequiredKeys } from "@hyper-fetch/core";
|
|
2
2
|
import { Time } from "@hyper-fetch/core";
|
|
3
|
-
|
|
4
3
|
import type { UseFetchOptionsType } from "hooks/use-fetch";
|
|
5
4
|
|
|
6
5
|
type DefaultOptionsType = RequiredKeys<Omit<UseFetchOptionsType<RequestInstance>, "initialResponse">> & {
|
|
@@ -7,12 +7,11 @@ import type {
|
|
|
7
7
|
ExtractAdapterExtraType,
|
|
8
8
|
} from "@hyper-fetch/core";
|
|
9
9
|
import { scopeKey } from "@hyper-fetch/core";
|
|
10
|
-
import { useRef } from "react";
|
|
11
|
-
|
|
12
10
|
import { useRequestEvents, useTrackedState } from "helpers";
|
|
13
11
|
import type { UseFetchOptionsType, UseFetchReturnType } from "hooks/use-fetch";
|
|
14
12
|
import { useFetchDefaultOptions } from "hooks/use-fetch";
|
|
15
13
|
import { useProvider } from "provider";
|
|
14
|
+
import { useRef } from "react";
|
|
16
15
|
import { createTrackedProxy, getBounceData } from "utils";
|
|
17
16
|
|
|
18
17
|
type SuspenseEntry = { promise: Promise<void>; resolve: () => void; cleanup: () => void };
|
|
@@ -102,10 +101,14 @@ export const useFetch = <R extends RequestInstance>(
|
|
|
102
101
|
// ******************
|
|
103
102
|
// Fetching
|
|
104
103
|
// ******************
|
|
105
|
-
const handleFetch = () => {
|
|
104
|
+
const handleFetch = (options?: { force?: boolean }) => {
|
|
106
105
|
if (!disabled) {
|
|
107
106
|
logger.debug({ title: `Fetching data`, type: "system", extra: { request } });
|
|
108
|
-
|
|
107
|
+
// A forced fetch must not be deduplicated into an already running request: that request
|
|
108
|
+
// started earlier, so its response can be older than the state that prompted the call.
|
|
109
|
+
// Manual refetch() promises data at least as fresh as the moment it was called.
|
|
110
|
+
const requestToAdd = options?.force ? request.setDeduplicate(false) : request;
|
|
111
|
+
dispatcher.add(requestToAdd as unknown as R);
|
|
109
112
|
} else {
|
|
110
113
|
logger.debug({ title: `Cannot add to fetch queue`, type: "system", extra: { disabled } });
|
|
111
114
|
}
|
|
@@ -143,7 +146,7 @@ export const useFetch = <R extends RequestInstance>(
|
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
const refetch = () => {
|
|
146
|
-
handleFetch();
|
|
149
|
+
handleFetch({ force: true });
|
|
147
150
|
handleRefresh();
|
|
148
151
|
};
|
|
149
152
|
|
|
@@ -270,10 +273,10 @@ export const useFetch = <R extends RequestInstance>(
|
|
|
270
273
|
const suspenseResult = suspenseResultMap.get(cacheKey);
|
|
271
274
|
if (suspenseResult) {
|
|
272
275
|
suspenseResultMap.delete(cacheKey);
|
|
273
|
-
if (suspenseResult.data !== null) state.data = suspenseResult.data;
|
|
274
|
-
if (suspenseResult.error !== null) state.error = suspenseResult.error;
|
|
275
|
-
if (suspenseResult.status !== null) state.status = suspenseResult.status;
|
|
276
|
-
if (suspenseResult.extra !== null) state.extra = suspenseResult.extra;
|
|
276
|
+
if (suspenseResult.data !== null) {state.data = suspenseResult.data;}
|
|
277
|
+
if (suspenseResult.error !== null) {state.error = suspenseResult.error;}
|
|
278
|
+
if (suspenseResult.status !== null) {state.status = suspenseResult.status;}
|
|
279
|
+
if (suspenseResult.extra !== null) {state.extra = suspenseResult.extra;}
|
|
277
280
|
state.success = suspenseResult.success;
|
|
278
281
|
}
|
|
279
282
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useDidUpdate, useWillUnmount } from "@better-hooks/lifecycle";
|
|
2
2
|
import type { ListenerInstance, ExtractListenerResponseType } from "@hyper-fetch/sockets";
|
|
3
|
-
import { useRef } from "react";
|
|
4
|
-
|
|
5
3
|
import { useSocketState } from "helpers";
|
|
6
4
|
import type { UseListenerOptionsType } from "hooks/use-listener";
|
|
7
5
|
import { useProvider } from "provider";
|
|
6
|
+
import { useRef } from "react";
|
|
8
7
|
import { createTrackedProxy } from "utils";
|
|
9
8
|
|
|
10
9
|
/** Subscribe to incoming socket messages on a given listener topic with tracked connection state and callbacks. */
|
|
@@ -39,7 +38,7 @@ export const useListener = <ListenerType extends ListenerInstance>(
|
|
|
39
38
|
onEventCallback.current?.({ data, extra });
|
|
40
39
|
actions.setData(data);
|
|
41
40
|
actions.setExtra(extra);
|
|
42
|
-
actions.setTimestamp(
|
|
41
|
+
actions.setTimestamp(Date.now());
|
|
43
42
|
});
|
|
44
43
|
};
|
|
45
44
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { RequestInstance, ResolvedQueueItemType, QueueDataType, QueueItemType } from "@hyper-fetch/core";
|
|
2
2
|
import { Request, getRequestDispatcher, scopeKey } from "@hyper-fetch/core";
|
|
3
|
-
import { useState, useEffect, useCallback } from "react";
|
|
4
|
-
|
|
5
3
|
import type { UseQueueOptionsType, QueueRequest, UseQueueReturnType } from "hooks/use-queue";
|
|
6
4
|
import { useQueueDefaultOptions } from "hooks/use-queue";
|
|
7
5
|
import { useProvider } from "provider";
|
|
6
|
+
import { useState, useEffect, useCallback } from "react";
|
|
8
7
|
|
|
9
8
|
const canUpdate = (
|
|
10
9
|
item: Pick<QueueRequest<RequestInstance>, "success" | "failed" | "canceled" | "removed" | "resolved">,
|
|
@@ -70,7 +70,7 @@ export const useStream = <T extends RequestInstance>(
|
|
|
70
70
|
while (true) {
|
|
71
71
|
// eslint-disable-next-line no-await-in-loop
|
|
72
72
|
const { done, value } = await reader.read();
|
|
73
|
-
if (done) break;
|
|
73
|
+
if (done) {break;}
|
|
74
74
|
|
|
75
75
|
state.current.chunks = [...state.current.chunks, value];
|
|
76
76
|
state.current.text += decoder.decode(value, { stream: true });
|
|
@@ -80,15 +80,15 @@ export const useStream = <T extends RequestInstance>(
|
|
|
80
80
|
state.current.streaming = false;
|
|
81
81
|
state.current.done = true;
|
|
82
82
|
emitChange();
|
|
83
|
-
} catch (
|
|
83
|
+
} catch (error) {
|
|
84
84
|
state.current.streaming = false;
|
|
85
|
-
state.current.error =
|
|
85
|
+
state.current.error = error as ExtractErrorType<T>;
|
|
86
86
|
emitChange();
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
const start = useCallback(() => {
|
|
91
|
-
if (state.current.streaming) return;
|
|
91
|
+
if (state.current.streaming) {return;}
|
|
92
92
|
|
|
93
93
|
state.current = {
|
|
94
94
|
...getInitialState<T>(),
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useDidMount } from "@better-hooks/lifecycle";
|
|
2
|
+
import { useDebounce, useThrottle } from "@better-hooks/performance";
|
|
1
3
|
import type {
|
|
2
4
|
ExtractAdapterResolvedType,
|
|
3
5
|
RequestInstance,
|
|
@@ -9,15 +11,12 @@ import type {
|
|
|
9
11
|
ExtractAdapterType,
|
|
10
12
|
} from "@hyper-fetch/core";
|
|
11
13
|
import { sendRequest } from "@hyper-fetch/core";
|
|
12
|
-
import { useDidMount } from "@better-hooks/lifecycle";
|
|
13
|
-
import { useDebounce, useThrottle } from "@better-hooks/performance";
|
|
14
|
-
import { useMemo, useRef } from "react";
|
|
15
|
-
|
|
16
|
-
import type { UseSubmitOptionsType, UseSubmitReturnType } from "hooks/use-submit";
|
|
17
|
-
import { useSubmitDefaultOptions } from "hooks/use-submit";
|
|
18
14
|
import type { UseTrackedStateType } from "helpers";
|
|
19
15
|
import { useTrackedState, useRequestEvents } from "helpers";
|
|
16
|
+
import type { UseSubmitOptionsType, UseSubmitReturnType } from "hooks/use-submit";
|
|
17
|
+
import { useSubmitDefaultOptions } from "hooks/use-submit";
|
|
20
18
|
import { useProvider } from "provider";
|
|
19
|
+
import { useMemo, useRef } from "react";
|
|
21
20
|
import { createTrackedProxy, getBounceData } from "utils";
|
|
22
21
|
|
|
23
22
|
/**
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { ExtractAdapterResolvedType, NullableType, RequestInstance, RequestSendType } from "@hyper-fetch/core";
|
|
2
|
-
|
|
3
|
-
import type { isEqual } from "utils";
|
|
4
2
|
import type {
|
|
5
3
|
OnProgressCallbackType,
|
|
6
4
|
OnStartCallbackType,
|
|
@@ -10,6 +8,7 @@ import type {
|
|
|
10
8
|
UseTrackedStateType,
|
|
11
9
|
UseTrackedStateActions,
|
|
12
10
|
} from "helpers";
|
|
11
|
+
import type { isEqual } from "utils";
|
|
13
12
|
|
|
14
13
|
export type UseSubmitOptionsType<T extends RequestInstance> = {
|
|
15
14
|
/**
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { RequestInstance } from "@hyper-fetch/core";
|
|
2
|
-
import type React from "react";
|
|
3
|
-
|
|
4
|
-
import type { UseSubmitOptionsType } from "hooks/use-submit";
|
|
5
2
|
import type { UseCacheOptionsType } from "hooks/use-cache";
|
|
6
|
-
import type { UseQueueOptionsType } from "hooks/use-queue";
|
|
7
|
-
import type { UseListenerOptionsType } from "hooks/use-listener";
|
|
8
3
|
import type { UseEmitterOptionsType } from "hooks/use-emitter";
|
|
9
4
|
import type { UseFetchOptionsType } from "hooks/use-fetch";
|
|
5
|
+
import type { UseListenerOptionsType } from "hooks/use-listener";
|
|
6
|
+
import type { UseQueueOptionsType } from "hooks/use-queue";
|
|
7
|
+
import type { UseSubmitOptionsType } from "hooks/use-submit";
|
|
8
|
+
import type React from "react";
|
|
10
9
|
|
|
11
10
|
export type ProviderOptionsType = {
|
|
12
11
|
useFetchConfig?: Partial<UseFetchOptionsType<RequestInstance>>;
|