floppy-disk 2.7.0 → 2.7.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.
package/README.md CHANGED
@@ -9,7 +9,7 @@ Both are awesome state manager. That's why this Floppy Disk library behaves like
9
9
 
10
10
  ```js
11
11
  import { create } from 'zustand'; // 3.3 kB (gzipped: 1.5 kB)
12
- import { createStore } from 'floppy-disk'; // 1.3 kB (gzipped: 702 B) 🎉
12
+ import { createStore } from 'floppy-disk'; // 1.4 kB (gzipped: 714 B) 🎉
13
13
 
14
14
  import {
15
15
  QueryClient,
@@ -18,13 +18,13 @@ import {
18
18
  useInfiniteQuery,
19
19
  useMutation,
20
20
  } from '@tanstack/react-query'; // 41 kB (gzipped: 11 kB)
21
- import { createQuery, createMutation } from 'floppy-disk'; // 9.2 kB (gzipped: 3.1 kB) 🎉
21
+ import { createQuery, createMutation } from 'floppy-disk'; // 9.5 kB (gzipped: 3.2 kB) 🎉
22
22
  ```
23
23
 
24
24
  - Using Zustand & React-Query: https://demo-zustand-react-query.vercel.app/
25
25
  👉 Total: **309.21 kB**
26
26
  - Using Floppy Disk: https://demo-floppy-disk.vercel.app/
27
- 👉 Total: **271.15 kB** 🎉
27
+ 👉 Total: **272.63 kB** 🎉
28
28
 
29
29
  ## Key Features
30
30
 
@@ -122,7 +122,7 @@ function Control() {
122
122
  }
123
123
  ```
124
124
 
125
- > Example: [https://codesandbox.io/.../examples/react/basic](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk/tree/main/examples/react/basic)
125
+ > Example: [https://codesandbox.io/.../examples/react/basic](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk-site/tree/main/examples/react/basic)
126
126
 
127
127
  Control the reactivity. The concept is same as useEffect dependency array.
128
128
 
@@ -153,7 +153,7 @@ function Cat() {
153
153
  }
154
154
  ```
155
155
 
156
- > Example: [https://codesandbox.io/.../examples/react/custom-reactivity](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk/tree/main/examples/react/custom-reactivity)
156
+ > Example: [https://codesandbox.io/.../examples/react/custom-reactivity](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk-site/tree/main/examples/react/custom-reactivity)
157
157
 
158
158
  Reading/writing state and reacting to changes outside of components.
159
159
 
@@ -227,8 +227,8 @@ const useCatStore = createStore(
227
227
  ```
228
228
 
229
229
  > Example:
230
- > [https://codesandbox.io/.../examples/react/store-event](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk/tree/main/examples/react/store-event)
231
- > [https://codesandbox.io/.../examples/react/intercept](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk/tree/main/examples/react/intercept)
230
+ > [https://codesandbox.io/.../examples/react/store-event](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk-site/tree/main/examples/react/store-event)
231
+ > [https://codesandbox.io/.../examples/react/intercept](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk-site/tree/main/examples/react/intercept)
232
232
 
233
233
  Let's go wild using IIFE.
234
234
 
@@ -287,7 +287,7 @@ function CatPageOptimized() {
287
287
  }
288
288
  ```
289
289
 
290
- > Example: [https://codesandbox.io/.../examples/react/watch-component](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk/tree/main/examples/react/watch-component)
290
+ > Example: [https://codesandbox.io/.../examples/react/watch-component](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk-site/tree/main/examples/react/watch-component)
291
291
 
292
292
  Want a local state instead of global state?
293
293
  Or, want to set the initial state inside component?
@@ -342,7 +342,7 @@ function CatIsSleeping() {
342
342
  }
343
343
  ```
344
344
 
345
- > Example: [https://codesandbox.io/.../examples/react/local-state](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk/tree/main/examples/react/local-state)
345
+ > Example: [https://codesandbox.io/.../examples/react/local-state](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk-site/tree/main/examples/react/local-state)
346
346
 
347
347
  Set default reactivity.
348
348
 
@@ -417,7 +417,7 @@ function Control({ catId }) {
417
417
  }
418
418
  ```
419
419
 
420
- > Example: [https://codesandbox.io/.../examples/react/stores](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk/tree/main/examples/react/stores)
420
+ > Example: [https://codesandbox.io/.../examples/react/stores](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk-site/tree/main/examples/react/stores)
421
421
 
422
422
  <br><br>
423
423
 
@@ -510,7 +510,7 @@ function SingleQuery() {
510
510
  }
511
511
  ```
512
512
 
513
- > Example: [https://codesandbox.io/.../examples/react/query](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk/tree/main/examples/react/query)
513
+ > Example: [https://codesandbox.io/.../examples/react/query](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk-site/tree/main/examples/react/query)
514
514
 
515
515
  Actions:
516
516
 
@@ -608,7 +608,7 @@ function PokemonPage() {
608
608
  }
609
609
  ```
610
610
 
611
- > Example: [https://codesandbox.io/.../examples/react/query-with-param](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk/tree/main/examples/react/query-with-param)
611
+ > Example: [https://codesandbox.io/.../examples/react/query-with-param](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk-site/tree/main/examples/react/query-with-param)
612
612
 
613
613
  Get data or do something outside component:
614
614
 
@@ -667,7 +667,7 @@ function PokemonListPage() {
667
667
  }
668
668
  ```
669
669
 
670
- > Example: [https://codesandbox.io/.../examples/react/infinite-query](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk/tree/main/examples/react/infinite-query)
670
+ > Example: [https://codesandbox.io/.../examples/react/infinite-query](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk-site/tree/main/examples/react/infinite-query)
671
671
 
672
672
  **Note:**
673
673
 
@@ -753,7 +753,7 @@ function SaveProduct() {
753
753
  }
754
754
  ```
755
755
 
756
- > Example: [https://codesandbox.io/.../examples/react/mutation](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk/tree/main/examples/react/mutation)
756
+ > Example: [https://codesandbox.io/.../examples/react/mutation](https://codesandbox.io/p/sandbox/github/afiiif/floppy-disk-site/tree/main/examples/react/mutation)
757
757
 
758
758
  <br><br>
759
759
 
@@ -99,6 +99,8 @@ export type QueryState<TKey extends StoreKey = StoreKey, TResponse = any, TData
99
99
  isLoading: true;
100
100
  /**
101
101
  * Data state, will be `true` if the query has a data.
102
+ *
103
+ * @see https://floppy-disk.vercel.app/docs/query/introduction#query-state--network-fetching-state
102
104
  */
103
105
  isSuccess: false;
104
106
  /**
@@ -107,6 +109,8 @@ export type QueryState<TKey extends StoreKey = StoreKey, TResponse = any, TData
107
109
  * This will only happened if an error occured after first fetch.
108
110
  *
109
111
  * If data fetched successfully but then an error occured, `isError` will be `false` but `isRefetchError` will be `true`.
112
+ *
113
+ * @see https://floppy-disk.vercel.app/docs/query/introduction#query-state--network-fetching-state
110
114
  */
111
115
  isError: false;
112
116
  data: undefined;
@@ -203,7 +207,6 @@ export type CreateQueryOptions<TKey extends StoreKey = StoreKey, TResponse = any
203
207
  * This function should return a variable that will be stored as `pageParam` that can be used when fetching next page.
204
208
  */
205
209
  getNextPageParam?: (lastPage: TResponse, index: number, stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => Maybe<TPageParam>;
206
- onBeforeFetch?: (cancel: () => void, state: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
207
210
  onSuccess?: (response: TResponse, stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
208
211
  onError?: (error: TError, stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
209
212
  onSettled?: (stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
@@ -40,7 +40,7 @@ export const createQuery = (queryFn, options = {}) => {
40
40
  const defaultFetchOnReconnect = options.fetchOnMount ?? true;
41
41
  const { onFirstSubscribe = noop, onSubscribe = noop, onLastUnsubscribe = noop, onBeforeChangeKey = noop, defaultDeps = useQueryDefaultDeps, select = identityFn, staleTime = 3000, // 3 seconds
42
42
  fetchOnMount = true, fetchOnWindowFocus = defaultFetchOnWindowFocus, fetchOnReconnect = defaultFetchOnReconnect, enabled = true, retry = 1, retryDelay = 2000, // 2 seconds
43
- keepPreviousData, getNextPageParam = () => undefined, onBeforeFetch = noop, onSuccess = noop, onError = noop, onSettled = noop, cacheTime = 5 * 60 * 1000, refetchInterval = false, ...createStoresOptions } = options;
43
+ keepPreviousData, getNextPageParam = () => undefined, onSuccess = noop, onError = noop, onSettled = noop, cacheTime = 5 * 60 * 1000, refetchInterval = false, ...createStoresOptions } = options;
44
44
  const retryTimeoutId = new Map();
45
45
  const retryNextPageTimeoutId = new Map();
46
46
  const resetTimeoutId = new Map();
@@ -63,13 +63,6 @@ export const createQuery = (queryFn, options = {}) => {
63
63
  clearTimeout(refetchIntervalTimeoutId.get(keyHash));
64
64
  if (isWaiting || !getValueOrComputedValue(enabled, key))
65
65
  return resolve(state);
66
- let shouldcancel = false;
67
- const cancel = () => {
68
- shouldcancel = true;
69
- };
70
- onBeforeFetch(cancel, state);
71
- if (shouldcancel)
72
- return resolve(state);
73
66
  if (isLoading)
74
67
  set({ isWaiting: true });
75
68
  else
@@ -192,14 +185,7 @@ export const createQuery = (queryFn, options = {}) => {
192
185
  const { isLoading, isWaitingNextPage, data, hasNextPage, pageParam, pageParams } = state;
193
186
  if (isLoading)
194
187
  return resolve(forceFetch());
195
- if (isWaitingNextPage || !hasNextPage)
196
- return resolve(state);
197
- let shouldcancel = false;
198
- const cancel = () => {
199
- shouldcancel = true;
200
- };
201
- onBeforeFetch(cancel, state);
202
- if (shouldcancel)
188
+ if (isWaitingNextPage || !hasNextPage || !getValueOrComputedValue(enabled, key))
203
189
  return resolve(state);
204
190
  set({ isWaitingNextPage: true, isGoingToRetryNextPage: false });
205
191
  clearTimeout(retryNextPageTimeoutId.get(keyHash));
@@ -98,6 +98,8 @@ export type QueryState<TKey extends StoreKey = StoreKey, TResponse = any, TData
98
98
  isLoading: true;
99
99
  /**
100
100
  * Data state, will be `true` if the query has a data.
101
+ *
102
+ * @see https://floppy-disk.vercel.app/docs/query/introduction#query-state--network-fetching-state
101
103
  */
102
104
  isSuccess: false;
103
105
  /**
@@ -106,6 +108,8 @@ export type QueryState<TKey extends StoreKey = StoreKey, TResponse = any, TData
106
108
  * This will only happened if an error occured after first fetch.
107
109
  *
108
110
  * If data fetched successfully but then an error occured, `isError` will be `false` but `isRefetchError` will be `true`.
111
+ *
112
+ * @see https://floppy-disk.vercel.app/docs/query/introduction#query-state--network-fetching-state
109
113
  */
110
114
  isError: false;
111
115
  data: undefined;
@@ -202,7 +206,6 @@ export type CreateQueryOptions<TKey extends StoreKey = StoreKey, TResponse = any
202
206
  * This function should return a variable that will be stored as `pageParam` that can be used when fetching next page.
203
207
  */
204
208
  getNextPageParam?: (lastPage: TResponse, index: number, stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => Maybe<TPageParam>;
205
- onBeforeFetch?: (cancel: () => void, state: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
206
209
  onSuccess?: (response: TResponse, stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
207
210
  onError?: (error: TError, stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
208
211
  onSettled?: (stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
@@ -39,7 +39,7 @@ export const createQuery = (queryFn, options = {}) => {
39
39
  const defaultFetchOnReconnect = options.fetchOnMount ?? true;
40
40
  const { onFirstSubscribe = noop, onSubscribe = noop, onLastUnsubscribe = noop, onBeforeChangeKey = noop, defaultDeps = useQueryDefaultDeps, select = identityFn, staleTime = 3000, // 3 seconds
41
41
  fetchOnMount = true, fetchOnWindowFocus = defaultFetchOnWindowFocus, fetchOnReconnect = defaultFetchOnReconnect, enabled = true, retry = 1, retryDelay = 2000, // 2 seconds
42
- keepPreviousData, getNextPageParam = () => undefined, onBeforeFetch = noop, onSuccess = noop, onError = noop, onSettled = noop, cacheTime = 5 * 60 * 1000, refetchInterval = false, ...createStoresOptions } = options;
42
+ keepPreviousData, getNextPageParam = () => undefined, onSuccess = noop, onError = noop, onSettled = noop, cacheTime = 5 * 60 * 1000, refetchInterval = false, ...createStoresOptions } = options;
43
43
  const retryTimeoutId = new Map();
44
44
  const retryNextPageTimeoutId = new Map();
45
45
  const resetTimeoutId = new Map();
@@ -62,13 +62,6 @@ export const createQuery = (queryFn, options = {}) => {
62
62
  clearTimeout(refetchIntervalTimeoutId.get(keyHash));
63
63
  if (isWaiting || !getValueOrComputedValue(enabled, key))
64
64
  return resolve(state);
65
- let shouldcancel = false;
66
- const cancel = () => {
67
- shouldcancel = true;
68
- };
69
- onBeforeFetch(cancel, state);
70
- if (shouldcancel)
71
- return resolve(state);
72
65
  if (isLoading)
73
66
  set({ isWaiting: true });
74
67
  else
@@ -191,14 +184,7 @@ export const createQuery = (queryFn, options = {}) => {
191
184
  const { isLoading, isWaitingNextPage, data, hasNextPage, pageParam, pageParams } = state;
192
185
  if (isLoading)
193
186
  return resolve(forceFetch());
194
- if (isWaitingNextPage || !hasNextPage)
195
- return resolve(state);
196
- let shouldcancel = false;
197
- const cancel = () => {
198
- shouldcancel = true;
199
- };
200
- onBeforeFetch(cancel, state);
201
- if (shouldcancel)
187
+ if (isWaitingNextPage || !hasNextPage || !getValueOrComputedValue(enabled, key))
202
188
  return resolve(state);
203
189
  set({ isWaitingNextPage: true, isGoingToRetryNextPage: false });
204
190
  clearTimeout(retryNextPageTimeoutId.get(keyHash));
@@ -99,6 +99,8 @@ export type QueryState<TKey extends StoreKey = StoreKey, TResponse = any, TData
99
99
  isLoading: true;
100
100
  /**
101
101
  * Data state, will be `true` if the query has a data.
102
+ *
103
+ * @see https://floppy-disk.vercel.app/docs/query/introduction#query-state--network-fetching-state
102
104
  */
103
105
  isSuccess: false;
104
106
  /**
@@ -107,6 +109,8 @@ export type QueryState<TKey extends StoreKey = StoreKey, TResponse = any, TData
107
109
  * This will only happened if an error occured after first fetch.
108
110
  *
109
111
  * If data fetched successfully but then an error occured, `isError` will be `false` but `isRefetchError` will be `true`.
112
+ *
113
+ * @see https://floppy-disk.vercel.app/docs/query/introduction#query-state--network-fetching-state
110
114
  */
111
115
  isError: false;
112
116
  data: undefined;
@@ -203,7 +207,6 @@ export type CreateQueryOptions<TKey extends StoreKey = StoreKey, TResponse = any
203
207
  * This function should return a variable that will be stored as `pageParam` that can be used when fetching next page.
204
208
  */
205
209
  getNextPageParam?: (lastPage: TResponse, index: number, stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => Maybe<TPageParam>;
206
- onBeforeFetch?: (cancel: () => void, state: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
207
210
  onSuccess?: (response: TResponse, stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
208
211
  onError?: (error: TError, stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
209
212
  onSettled?: (stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
@@ -43,7 +43,7 @@ const createQuery = (queryFn, options = {}) => {
43
43
  const defaultFetchOnReconnect = options.fetchOnMount ?? true;
44
44
  const { onFirstSubscribe = utils_1.noop, onSubscribe = utils_1.noop, onLastUnsubscribe = utils_1.noop, onBeforeChangeKey = utils_1.noop, defaultDeps = useQueryDefaultDeps, select = utils_1.identityFn, staleTime = 3000, // 3 seconds
45
45
  fetchOnMount = true, fetchOnWindowFocus = defaultFetchOnWindowFocus, fetchOnReconnect = defaultFetchOnReconnect, enabled = true, retry = 1, retryDelay = 2000, // 2 seconds
46
- keepPreviousData, getNextPageParam = () => undefined, onBeforeFetch = utils_1.noop, onSuccess = utils_1.noop, onError = utils_1.noop, onSettled = utils_1.noop, cacheTime = 5 * 60 * 1000, refetchInterval = false, ...createStoresOptions } = options;
46
+ keepPreviousData, getNextPageParam = () => undefined, onSuccess = utils_1.noop, onError = utils_1.noop, onSettled = utils_1.noop, cacheTime = 5 * 60 * 1000, refetchInterval = false, ...createStoresOptions } = options;
47
47
  const retryTimeoutId = new Map();
48
48
  const retryNextPageTimeoutId = new Map();
49
49
  const resetTimeoutId = new Map();
@@ -66,13 +66,6 @@ const createQuery = (queryFn, options = {}) => {
66
66
  clearTimeout(refetchIntervalTimeoutId.get(keyHash));
67
67
  if (isWaiting || !(0, utils_1.getValueOrComputedValue)(enabled, key))
68
68
  return resolve(state);
69
- let shouldcancel = false;
70
- const cancel = () => {
71
- shouldcancel = true;
72
- };
73
- onBeforeFetch(cancel, state);
74
- if (shouldcancel)
75
- return resolve(state);
76
69
  if (isLoading)
77
70
  set({ isWaiting: true });
78
71
  else
@@ -195,14 +188,7 @@ const createQuery = (queryFn, options = {}) => {
195
188
  const { isLoading, isWaitingNextPage, data, hasNextPage, pageParam, pageParams } = state;
196
189
  if (isLoading)
197
190
  return resolve(forceFetch());
198
- if (isWaitingNextPage || !hasNextPage)
199
- return resolve(state);
200
- let shouldcancel = false;
201
- const cancel = () => {
202
- shouldcancel = true;
203
- };
204
- onBeforeFetch(cancel, state);
205
- if (shouldcancel)
191
+ if (isWaitingNextPage || !hasNextPage || !(0, utils_1.getValueOrComputedValue)(enabled, key))
206
192
  return resolve(state);
207
193
  set({ isWaitingNextPage: true, isGoingToRetryNextPage: false });
208
194
  clearTimeout(retryNextPageTimeoutId.get(keyHash));
@@ -98,6 +98,8 @@ export type QueryState<TKey extends StoreKey = StoreKey, TResponse = any, TData
98
98
  isLoading: true;
99
99
  /**
100
100
  * Data state, will be `true` if the query has a data.
101
+ *
102
+ * @see https://floppy-disk.vercel.app/docs/query/introduction#query-state--network-fetching-state
101
103
  */
102
104
  isSuccess: false;
103
105
  /**
@@ -106,6 +108,8 @@ export type QueryState<TKey extends StoreKey = StoreKey, TResponse = any, TData
106
108
  * This will only happened if an error occured after first fetch.
107
109
  *
108
110
  * If data fetched successfully but then an error occured, `isError` will be `false` but `isRefetchError` will be `true`.
111
+ *
112
+ * @see https://floppy-disk.vercel.app/docs/query/introduction#query-state--network-fetching-state
109
113
  */
110
114
  isError: false;
111
115
  data: undefined;
@@ -202,7 +206,6 @@ export type CreateQueryOptions<TKey extends StoreKey = StoreKey, TResponse = any
202
206
  * This function should return a variable that will be stored as `pageParam` that can be used when fetching next page.
203
207
  */
204
208
  getNextPageParam?: (lastPage: TResponse, index: number, stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => Maybe<TPageParam>;
205
- onBeforeFetch?: (cancel: () => void, state: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
206
209
  onSuccess?: (response: TResponse, stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
207
210
  onError?: (error: TError, stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
208
211
  onSettled?: (stateBeforeCallQuery: QueryState<TKey, TResponse, TData, TError, TPageParam>) => void;
@@ -42,7 +42,7 @@ const createQuery = (queryFn, options = {}) => {
42
42
  const defaultFetchOnReconnect = options.fetchOnMount ?? true;
43
43
  const { onFirstSubscribe = utils_1.noop, onSubscribe = utils_1.noop, onLastUnsubscribe = utils_1.noop, onBeforeChangeKey = utils_1.noop, defaultDeps = useQueryDefaultDeps, select = utils_1.identityFn, staleTime = 3000, // 3 seconds
44
44
  fetchOnMount = true, fetchOnWindowFocus = defaultFetchOnWindowFocus, fetchOnReconnect = defaultFetchOnReconnect, enabled = true, retry = 1, retryDelay = 2000, // 2 seconds
45
- keepPreviousData, getNextPageParam = () => undefined, onBeforeFetch = utils_1.noop, onSuccess = utils_1.noop, onError = utils_1.noop, onSettled = utils_1.noop, cacheTime = 5 * 60 * 1000, refetchInterval = false, ...createStoresOptions } = options;
45
+ keepPreviousData, getNextPageParam = () => undefined, onSuccess = utils_1.noop, onError = utils_1.noop, onSettled = utils_1.noop, cacheTime = 5 * 60 * 1000, refetchInterval = false, ...createStoresOptions } = options;
46
46
  const retryTimeoutId = new Map();
47
47
  const retryNextPageTimeoutId = new Map();
48
48
  const resetTimeoutId = new Map();
@@ -65,13 +65,6 @@ const createQuery = (queryFn, options = {}) => {
65
65
  clearTimeout(refetchIntervalTimeoutId.get(keyHash));
66
66
  if (isWaiting || !(0, utils_1.getValueOrComputedValue)(enabled, key))
67
67
  return resolve(state);
68
- let shouldcancel = false;
69
- const cancel = () => {
70
- shouldcancel = true;
71
- };
72
- onBeforeFetch(cancel, state);
73
- if (shouldcancel)
74
- return resolve(state);
75
68
  if (isLoading)
76
69
  set({ isWaiting: true });
77
70
  else
@@ -194,14 +187,7 @@ const createQuery = (queryFn, options = {}) => {
194
187
  const { isLoading, isWaitingNextPage, data, hasNextPage, pageParam, pageParams } = state;
195
188
  if (isLoading)
196
189
  return resolve(forceFetch());
197
- if (isWaitingNextPage || !hasNextPage)
198
- return resolve(state);
199
- let shouldcancel = false;
200
- const cancel = () => {
201
- shouldcancel = true;
202
- };
203
- onBeforeFetch(cancel, state);
204
- if (shouldcancel)
190
+ if (isWaitingNextPage || !hasNextPage || !(0, utils_1.getValueOrComputedValue)(enabled, key))
205
191
  return resolve(state);
206
192
  set({ isWaitingNextPage: true, isGoingToRetryNextPage: false });
207
193
  clearTimeout(retryNextPageTimeoutId.get(keyHash));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "floppy-disk",
3
- "version": "2.7.0",
3
+ "version": "2.7.1",
4
4
  "description": "FloppyDisk - lightweight, simple, and powerful state management library",
5
5
  "keywords": [
6
6
  "state",