floppy-disk 2.2.0-beta.1 → 2.2.0-beta.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.
@@ -132,7 +132,10 @@ export type CreateQueryOptions<TKey extends StoreKey = StoreKey, TResponse = any
132
132
  */
133
133
  fetchOnMount?: boolean | 'always' | ((key: TKey) => boolean | 'always');
134
134
  /**
135
- * Defaults to `true`.
135
+ * Defaults to follow the value of `fetchOnMount`.
136
+ *
137
+ * `fetchOnMount` and `fetchOnWindowFocus` can be set to different values.
138
+ * However, if `fetchOnWindowFocus` is not explicitly set, it will mimic the value of `fetchOnMount`.
136
139
  *
137
140
  * - If set to `true`, the query will be called on window focus **if the data is stale**.
138
141
  * - If set to `false`, the query won't be called on window focus.
@@ -40,7 +40,7 @@ const useQueryDefaultDeps = (state) => [
40
40
  state.hasNextPage,
41
41
  ];
42
42
  export const createQuery = (queryFn, options = {}) => {
43
- const defaultFetchOnWindowFocus = options.fetchOnMount !== false;
43
+ const defaultFetchOnWindowFocus = options.fetchOnMount ?? true;
44
44
  const { onFirstSubscribe = noop, onSubscribe = noop, onLastUnsubscribe = noop, onBeforeChangeKey = noop, defaultDeps = useQueryDefaultDeps, select = identityFn, staleTime = 3000, // 3 seconds
45
45
  fetchOnMount = true, fetchOnWindowFocus = defaultFetchOnWindowFocus, enabled = true, retry = 1, retryDelay = 2000, // 2 seconds
46
46
  keepPreviousData, getNextPageParam = () => undefined, onSuccess = noop, onError = noop, onSettled = noop, ...createStoresOptions } = options;
@@ -132,7 +132,10 @@ export type CreateQueryOptions<TKey extends StoreKey = StoreKey, TResponse = any
132
132
  */
133
133
  fetchOnMount?: boolean | 'always' | ((key: TKey) => boolean | 'always');
134
134
  /**
135
- * Defaults to `true`.
135
+ * Defaults to follow the value of `fetchOnMount`.
136
+ *
137
+ * `fetchOnMount` and `fetchOnWindowFocus` can be set to different values.
138
+ * However, if `fetchOnWindowFocus` is not explicitly set, it will mimic the value of `fetchOnMount`.
136
139
  *
137
140
  * - If set to `true`, the query will be called on window focus **if the data is stale**.
138
141
  * - If set to `false`, the query won't be called on window focus.
@@ -40,7 +40,7 @@ const useQueryDefaultDeps = (state) => [
40
40
  state.hasNextPage,
41
41
  ];
42
42
  export const createQuery = (queryFn, options = {}) => {
43
- const defaultFetchOnWindowFocus = options.fetchOnMount !== false;
43
+ const defaultFetchOnWindowFocus = options.fetchOnMount ?? true;
44
44
  const { onFirstSubscribe = noop, onSubscribe = noop, onLastUnsubscribe = noop, onBeforeChangeKey = noop, defaultDeps = useQueryDefaultDeps, select = identityFn, staleTime = 3000, // 3 seconds
45
45
  fetchOnMount = true, fetchOnWindowFocus = defaultFetchOnWindowFocus, enabled = true, retry = 1, retryDelay = 2000, // 2 seconds
46
46
  keepPreviousData, getNextPageParam = () => undefined, onSuccess = noop, onError = noop, onSettled = noop, ...createStoresOptions } = options;
@@ -132,7 +132,10 @@ export type CreateQueryOptions<TKey extends StoreKey = StoreKey, TResponse = any
132
132
  */
133
133
  fetchOnMount?: boolean | 'always' | ((key: TKey) => boolean | 'always');
134
134
  /**
135
- * Defaults to `true`.
135
+ * Defaults to follow the value of `fetchOnMount`.
136
+ *
137
+ * `fetchOnMount` and `fetchOnWindowFocus` can be set to different values.
138
+ * However, if `fetchOnWindowFocus` is not explicitly set, it will mimic the value of `fetchOnMount`.
136
139
  *
137
140
  * - If set to `true`, the query will be called on window focus **if the data is stale**.
138
141
  * - If set to `false`, the query won't be called on window focus.
@@ -43,7 +43,7 @@ const useQueryDefaultDeps = (state) => [
43
43
  state.hasNextPage,
44
44
  ];
45
45
  const createQuery = (queryFn, options = {}) => {
46
- const defaultFetchOnWindowFocus = options.fetchOnMount !== false;
46
+ const defaultFetchOnWindowFocus = options.fetchOnMount ?? true;
47
47
  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
48
48
  fetchOnMount = true, fetchOnWindowFocus = defaultFetchOnWindowFocus, enabled = true, retry = 1, retryDelay = 2000, // 2 seconds
49
49
  keepPreviousData, getNextPageParam = () => undefined, onSuccess = utils_1.noop, onError = utils_1.noop, onSettled = utils_1.noop, ...createStoresOptions } = options;
@@ -132,7 +132,10 @@ export type CreateQueryOptions<TKey extends StoreKey = StoreKey, TResponse = any
132
132
  */
133
133
  fetchOnMount?: boolean | 'always' | ((key: TKey) => boolean | 'always');
134
134
  /**
135
- * Defaults to `true`.
135
+ * Defaults to follow the value of `fetchOnMount`.
136
+ *
137
+ * `fetchOnMount` and `fetchOnWindowFocus` can be set to different values.
138
+ * However, if `fetchOnWindowFocus` is not explicitly set, it will mimic the value of `fetchOnMount`.
136
139
  *
137
140
  * - If set to `true`, the query will be called on window focus **if the data is stale**.
138
141
  * - If set to `false`, the query won't be called on window focus.
@@ -43,7 +43,7 @@ const useQueryDefaultDeps = (state) => [
43
43
  state.hasNextPage,
44
44
  ];
45
45
  const createQuery = (queryFn, options = {}) => {
46
- const defaultFetchOnWindowFocus = options.fetchOnMount !== false;
46
+ const defaultFetchOnWindowFocus = options.fetchOnMount ?? true;
47
47
  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
48
48
  fetchOnMount = true, fetchOnWindowFocus = defaultFetchOnWindowFocus, enabled = true, retry = 1, retryDelay = 2000, // 2 seconds
49
49
  keepPreviousData, getNextPageParam = () => undefined, onSuccess = utils_1.noop, onError = utils_1.noop, onSettled = utils_1.noop, ...createStoresOptions } = options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "floppy-disk",
3
- "version": "2.2.0-beta.1",
3
+ "version": "2.2.0-beta.2",
4
4
  "description": "FloppyDisk - lightweight, simple, and powerful state management library",
5
5
  "keywords": [
6
6
  "state",