floppy-disk 2.13.0 → 2.14.0-beta.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.
|
@@ -4,7 +4,7 @@ import { createStore } from './create-store';
|
|
|
4
4
|
* @see https://floppy-disk.vercel.app/docs/api#createmutation
|
|
5
5
|
*/
|
|
6
6
|
export const createMutation = (mutationFn, options = {}) => {
|
|
7
|
-
const { onMutate = noop, onSuccess = noop, onError =
|
|
7
|
+
const { onMutate = noop, onSuccess = noop, onError = console.error, onSettled = noop, ...createStoreOptions } = options;
|
|
8
8
|
const useMutation = createStore(({ set, get }) => ({
|
|
9
9
|
isWaiting: false,
|
|
10
10
|
isSuccess: false,
|
|
@@ -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, onSuccess = noop, onError =
|
|
43
|
+
keepPreviousData, getNextPageParam = () => undefined, onSuccess = noop, onError = console.error, 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();
|
|
@@ -7,7 +7,7 @@ const create_store_1 = require("./create-store");
|
|
|
7
7
|
* @see https://floppy-disk.vercel.app/docs/api#createmutation
|
|
8
8
|
*/
|
|
9
9
|
const createMutation = (mutationFn, options = {}) => {
|
|
10
|
-
const { onMutate = utils_1.noop, onSuccess = utils_1.noop, onError =
|
|
10
|
+
const { onMutate = utils_1.noop, onSuccess = utils_1.noop, onError = console.error, onSettled = utils_1.noop, ...createStoreOptions } = options;
|
|
11
11
|
const useMutation = (0, create_store_1.createStore)(({ set, get }) => ({
|
|
12
12
|
isWaiting: false,
|
|
13
13
|
isSuccess: false,
|
|
@@ -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, onSuccess = utils_1.noop, onError =
|
|
46
|
+
keepPreviousData, getNextPageParam = () => undefined, onSuccess = utils_1.noop, onError = console.error, 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();
|