@refinedev/core 4.57.1 → 4.57.7
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/CHANGELOG.md +146 -0
- package/dist/contexts/refine/index.d.cts.map +1 -1
- package/dist/contexts/refine/index.d.ts.map +1 -1
- package/dist/definitions/helpers/generateDocumentTitle/index.d.cts +1 -1
- package/dist/definitions/helpers/generateDocumentTitle/index.d.cts.map +1 -1
- package/dist/definitions/helpers/generateDocumentTitle/index.d.mts +1 -1
- package/dist/definitions/helpers/generateDocumentTitle/index.d.mts.map +1 -1
- package/dist/definitions/helpers/generateDocumentTitle/index.d.ts +1 -1
- package/dist/definitions/helpers/generateDocumentTitle/index.d.ts.map +1 -1
- package/dist/definitions/helpers/safe-translate/index.d.cts +1 -1
- package/dist/definitions/helpers/safe-translate/index.d.cts.map +1 -1
- package/dist/definitions/helpers/safe-translate/index.d.mts +1 -1
- package/dist/definitions/helpers/safe-translate/index.d.mts.map +1 -1
- package/dist/definitions/helpers/safe-translate/index.d.ts +1 -1
- package/dist/definitions/helpers/safe-translate/index.d.ts.map +1 -1
- package/dist/hooks/data/useCreate.d.cts.map +1 -1
- package/dist/hooks/data/useCreate.d.ts.map +1 -1
- package/dist/hooks/data/useCreateMany.d.cts.map +1 -1
- package/dist/hooks/data/useCreateMany.d.ts.map +1 -1
- package/dist/hooks/data/useCustom.d.cts.map +1 -1
- package/dist/hooks/data/useCustom.d.ts.map +1 -1
- package/dist/hooks/data/useCustomMutation.d.cts.map +1 -1
- package/dist/hooks/data/useCustomMutation.d.ts.map +1 -1
- package/dist/hooks/data/useDelete.d.cts.map +1 -1
- package/dist/hooks/data/useDelete.d.ts.map +1 -1
- package/dist/hooks/data/useDeleteMany.d.cts.map +1 -1
- package/dist/hooks/data/useDeleteMany.d.ts.map +1 -1
- package/dist/hooks/data/useInfiniteList.d.cts.map +1 -1
- package/dist/hooks/data/useInfiniteList.d.ts.map +1 -1
- package/dist/hooks/data/useList.d.cts.map +1 -1
- package/dist/hooks/data/useList.d.ts.map +1 -1
- package/dist/hooks/data/useMany.d.cts.map +1 -1
- package/dist/hooks/data/useMany.d.ts.map +1 -1
- package/dist/hooks/data/useOne.d.cts.map +1 -1
- package/dist/hooks/data/useOne.d.ts.map +1 -1
- package/dist/hooks/data/useUpdate.d.cts.map +1 -1
- package/dist/hooks/data/useUpdate.d.ts.map +1 -1
- package/dist/hooks/data/useUpdateMany.d.cts.map +1 -1
- package/dist/hooks/data/useUpdateMany.d.ts.map +1 -1
- package/dist/hooks/form/index.d.cts.map +1 -1
- package/dist/hooks/form/index.d.ts.map +1 -1
- package/dist/hooks/show/index.d.cts.map +1 -1
- package/dist/hooks/show/index.d.ts.map +1 -1
- package/dist/hooks/useLoadingOvertime/index.d.cts +7 -1
- package/dist/hooks/useLoadingOvertime/index.d.cts.map +1 -1
- package/dist/hooks/useLoadingOvertime/index.d.mts +7 -1
- package/dist/hooks/useLoadingOvertime/index.d.mts.map +7 -1
- package/dist/hooks/useLoadingOvertime/index.d.ts +7 -1
- package/dist/hooks/useLoadingOvertime/index.d.ts.map +1 -1
- package/dist/hooks/useSelect/index.d.cts.map +1 -1
- package/dist/hooks/useSelect/index.d.ts.map +1 -1
- package/dist/hooks/useTable/index.d.cts +1 -1
- package/dist/hooks/useTable/index.d.cts.map +1 -1
- package/dist/hooks/useTable/index.d.mts +1 -1
- package/dist/hooks/useTable/index.d.mts.map +1 -1
- package/dist/hooks/useTable/index.d.ts +1 -1
- package/dist/hooks/useTable/index.d.ts.map +1 -1
- package/dist/index.cjs +22 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +22 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/contexts/refine/index.tsx +1 -0
- package/src/definitions/helpers/generateDocumentTitle/index.ts +1 -1
- package/src/definitions/helpers/safe-translate/index.ts +1 -1
- package/src/hooks/auth/useLogin/index.ts +6 -2
- package/src/hooks/auth/useRegister/index.ts +2 -2
- package/src/hooks/data/useCreate.ts +1 -2
- package/src/hooks/data/useCreateMany.ts +1 -2
- package/src/hooks/data/useCustom.ts +1 -2
- package/src/hooks/data/useCustomMutation.ts +1 -2
- package/src/hooks/data/useDelete.ts +1 -2
- package/src/hooks/data/useDeleteMany.ts +1 -2
- package/src/hooks/data/useInfiniteList.ts +1 -2
- package/src/hooks/data/useList.ts +1 -2
- package/src/hooks/data/useMany.ts +24 -5
- package/src/hooks/data/useOne.ts +1 -2
- package/src/hooks/data/useUpdate.ts +1 -2
- package/src/hooks/data/useUpdateMany.ts +1 -2
- package/src/hooks/form/index.ts +4 -2
- package/src/hooks/show/index.ts +3 -8
- package/src/hooks/useLoadingOvertime/index.ts +19 -3
- package/src/hooks/useSelect/index.ts +3 -2
- package/src/hooks/useTable/index.ts +5 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refinedev/core",
|
|
3
|
-
"version": "4.57.
|
|
3
|
+
"version": "4.57.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Refine is a React meta-framework for building enterprise-level, data-intensive applications rapidly with support for modern UI libraries and headless integrations.",
|
|
6
6
|
"repository": {
|
|
@@ -175,7 +175,9 @@ export function useLogin<TVariables = {}>({
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
setTimeout(() => {
|
|
179
|
+
invalidateAuthStore();
|
|
180
|
+
}, 32);
|
|
179
181
|
},
|
|
180
182
|
onError: (error: any) => {
|
|
181
183
|
open?.(buildNotification(error));
|
|
@@ -219,7 +221,9 @@ export function useLogin<TVariables = {}>({
|
|
|
219
221
|
}
|
|
220
222
|
}
|
|
221
223
|
|
|
222
|
-
|
|
224
|
+
setTimeout(() => {
|
|
225
|
+
invalidateAuthStore();
|
|
226
|
+
}, 32);
|
|
223
227
|
|
|
224
228
|
close?.("login-error");
|
|
225
229
|
},
|
|
@@ -131,6 +131,8 @@ export function useRegister<TVariables = {}>({
|
|
|
131
131
|
if (successNotification) {
|
|
132
132
|
open?.(buildSuccessNotification(successNotification));
|
|
133
133
|
}
|
|
134
|
+
|
|
135
|
+
await invalidateAuthStore();
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
if (error || !success) {
|
|
@@ -148,8 +150,6 @@ export function useRegister<TVariables = {}>({
|
|
|
148
150
|
replace("/");
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
|
-
|
|
152
|
-
await invalidateAuthStore();
|
|
153
153
|
},
|
|
154
154
|
onError: (error: any) => {
|
|
155
155
|
open?.(buildNotification(error));
|
|
@@ -315,9 +315,8 @@ export const useCreate = <
|
|
|
315
315
|
const { mutate, mutateAsync, ...mutation } = mutationResult;
|
|
316
316
|
|
|
317
317
|
const { elapsedTime } = useLoadingOvertime({
|
|
318
|
+
...overtimeOptions,
|
|
318
319
|
isLoading: mutation.isLoading,
|
|
319
|
-
interval: overtimeOptions?.interval,
|
|
320
|
-
onInterval: overtimeOptions?.onInterval,
|
|
321
320
|
});
|
|
322
321
|
|
|
323
322
|
// this function is used to make the `variables` parameter optional
|
|
@@ -293,9 +293,8 @@ export const useCreateMany = <
|
|
|
293
293
|
const { mutate, mutateAsync, ...mutation } = mutationResult;
|
|
294
294
|
|
|
295
295
|
const { elapsedTime } = useLoadingOvertime({
|
|
296
|
+
...overtimeOptions,
|
|
296
297
|
isLoading: mutation.isLoading,
|
|
297
|
-
interval: overtimeOptions?.interval,
|
|
298
|
-
onInterval: overtimeOptions?.onInterval,
|
|
299
298
|
});
|
|
300
299
|
|
|
301
300
|
// this function is used to make the `variables` parameter optional
|
|
@@ -217,9 +217,8 @@ export const useCustom = <
|
|
|
217
217
|
},
|
|
218
218
|
});
|
|
219
219
|
const { elapsedTime } = useLoadingOvertime({
|
|
220
|
+
...overtimeOptions,
|
|
220
221
|
isLoading: queryResponse.isFetching,
|
|
221
|
-
interval: overtimeOptions?.interval,
|
|
222
|
-
onInterval: overtimeOptions?.onInterval,
|
|
223
222
|
});
|
|
224
223
|
|
|
225
224
|
return { ...queryResponse, overtime: { elapsedTime } };
|
|
@@ -215,9 +215,8 @@ export const useCustomMutation = <
|
|
|
215
215
|
);
|
|
216
216
|
|
|
217
217
|
const { elapsedTime } = useLoadingOvertime({
|
|
218
|
+
...overtimeOptions,
|
|
218
219
|
isLoading: mutation.isLoading,
|
|
219
|
-
interval: overtimeOptions?.interval,
|
|
220
|
-
onInterval: overtimeOptions?.onInterval,
|
|
221
220
|
});
|
|
222
221
|
|
|
223
222
|
return { ...mutation, overtime: { elapsedTime } };
|
|
@@ -493,9 +493,8 @@ export const useDelete = <
|
|
|
493
493
|
});
|
|
494
494
|
|
|
495
495
|
const { elapsedTime } = useLoadingOvertime({
|
|
496
|
+
...overtimeOptions,
|
|
496
497
|
isLoading: mutation.isLoading,
|
|
497
|
-
interval: overtimeOptions?.interval,
|
|
498
|
-
onInterval: overtimeOptions?.onInterval,
|
|
499
498
|
});
|
|
500
499
|
|
|
501
500
|
return { ...mutation, overtime: { elapsedTime } };
|
|
@@ -524,9 +524,8 @@ export const useDeleteMany = <
|
|
|
524
524
|
});
|
|
525
525
|
|
|
526
526
|
const { elapsedTime } = useLoadingOvertime({
|
|
527
|
+
...overtimeOptions,
|
|
527
528
|
isLoading: mutation.isLoading,
|
|
528
|
-
interval: overtimeOptions?.interval,
|
|
529
|
-
onInterval: overtimeOptions?.onInterval,
|
|
530
529
|
});
|
|
531
530
|
|
|
532
531
|
return { ...mutation, overtime: { elapsedTime } };
|
|
@@ -320,9 +320,8 @@ export const useInfiniteList = <
|
|
|
320
320
|
});
|
|
321
321
|
|
|
322
322
|
const { elapsedTime } = useLoadingOvertime({
|
|
323
|
+
...overtimeOptions,
|
|
323
324
|
isLoading: queryResponse.isFetching,
|
|
324
|
-
interval: overtimeOptions?.interval,
|
|
325
|
-
onInterval: overtimeOptions?.onInterval,
|
|
326
325
|
});
|
|
327
326
|
|
|
328
327
|
return { ...queryResponse, overtime: { elapsedTime } };
|
|
@@ -326,9 +326,8 @@ export const useList = <
|
|
|
326
326
|
});
|
|
327
327
|
|
|
328
328
|
const { elapsedTime } = useLoadingOvertime({
|
|
329
|
+
...overtimeOptions,
|
|
329
330
|
isLoading: queryResponse.isFetching,
|
|
330
|
-
interval: overtimeOptions?.interval,
|
|
331
|
-
onInterval: overtimeOptions?.onInterval,
|
|
332
331
|
});
|
|
333
332
|
|
|
334
333
|
return { ...queryResponse, overtime: { elapsedTime } };
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
type UseLoadingOvertimeReturnType,
|
|
38
38
|
useLoadingOvertime,
|
|
39
39
|
} from "../useLoadingOvertime";
|
|
40
|
+
import warnOnce from "warn-once";
|
|
40
41
|
|
|
41
42
|
export type UseManyProps<TQueryFnData, TError, TData> = {
|
|
42
43
|
/**
|
|
@@ -133,17 +134,24 @@ export const useMany = <
|
|
|
133
134
|
|
|
134
135
|
const combinedMeta = getMeta({ resource, meta: preferredMeta });
|
|
135
136
|
|
|
137
|
+
const hasIds = Array.isArray(ids);
|
|
138
|
+
const hasResource = Boolean(resource?.name);
|
|
139
|
+
const manuallyEnabled = queryOptions?.enabled === true;
|
|
140
|
+
|
|
141
|
+
warnOnce(!hasIds && !manuallyEnabled, idsWarningMessage(ids, resource?.name));
|
|
142
|
+
warnOnce(!hasResource && !manuallyEnabled, resourceWarningMessage());
|
|
143
|
+
|
|
136
144
|
useResourceSubscription({
|
|
137
145
|
resource: identifier,
|
|
138
146
|
types: ["*"],
|
|
139
147
|
params: {
|
|
140
|
-
ids: ids,
|
|
148
|
+
ids: ids ?? [],
|
|
141
149
|
meta: combinedMeta,
|
|
142
150
|
metaData: combinedMeta,
|
|
143
151
|
subscriptionType: "useMany",
|
|
144
152
|
...liveParams,
|
|
145
153
|
},
|
|
146
|
-
channel: `resources/${resource
|
|
154
|
+
channel: `resources/${resource?.name ?? ""}`,
|
|
147
155
|
enabled: isEnabled,
|
|
148
156
|
liveMode,
|
|
149
157
|
onLiveEvent,
|
|
@@ -163,7 +171,7 @@ export const useMany = <
|
|
|
163
171
|
.data(pickedDataProvider)
|
|
164
172
|
.resource(identifier)
|
|
165
173
|
.action("many")
|
|
166
|
-
.ids(...ids)
|
|
174
|
+
.ids(...(ids ?? []))
|
|
167
175
|
.params({
|
|
168
176
|
...(preferredMeta || {}),
|
|
169
177
|
})
|
|
@@ -193,6 +201,7 @@ export const useMany = <
|
|
|
193
201
|
),
|
|
194
202
|
);
|
|
195
203
|
},
|
|
204
|
+
enabled: hasIds && hasResource,
|
|
196
205
|
...queryOptions,
|
|
197
206
|
onSuccess: (data) => {
|
|
198
207
|
queryOptions?.onSuccess?.(data);
|
|
@@ -231,10 +240,20 @@ export const useMany = <
|
|
|
231
240
|
});
|
|
232
241
|
|
|
233
242
|
const { elapsedTime } = useLoadingOvertime({
|
|
243
|
+
...overtimeOptions,
|
|
234
244
|
isLoading: queryResponse.isFetching,
|
|
235
|
-
interval: overtimeOptions?.interval,
|
|
236
|
-
onInterval: overtimeOptions?.onInterval,
|
|
237
245
|
});
|
|
238
246
|
|
|
239
247
|
return { ...queryResponse, overtime: { elapsedTime } };
|
|
240
248
|
};
|
|
249
|
+
|
|
250
|
+
const idsWarningMessage = (
|
|
251
|
+
ids: BaseKey[],
|
|
252
|
+
resource: string,
|
|
253
|
+
) => `[useMany]: Missing "ids" prop. Expected an array of ids, but got "${typeof ids}". Resource: "${resource}"
|
|
254
|
+
|
|
255
|
+
See https://refine.dev/docs/data/hooks/use-many/#ids-`;
|
|
256
|
+
|
|
257
|
+
const resourceWarningMessage = () => `[useMany]: Missing "resource" prop. Expected a string, but got undefined.
|
|
258
|
+
|
|
259
|
+
See https://refine.dev/docs/data/hooks/use-many/#resource-`;
|
package/src/hooks/data/useOne.ts
CHANGED
|
@@ -244,9 +244,8 @@ export const useOne = <
|
|
|
244
244
|
});
|
|
245
245
|
|
|
246
246
|
const { elapsedTime } = useLoadingOvertime({
|
|
247
|
+
...overtimeOptions,
|
|
247
248
|
isLoading: queryResponse.isFetching,
|
|
248
|
-
interval: overtimeOptions?.interval,
|
|
249
|
-
onInterval: overtimeOptions?.onInterval,
|
|
250
249
|
});
|
|
251
250
|
|
|
252
251
|
return { ...queryResponse, overtime: { elapsedTime } };
|
|
@@ -639,9 +639,8 @@ export const useUpdate = <
|
|
|
639
639
|
const { mutate, mutateAsync, ...mutation } = mutationResult;
|
|
640
640
|
|
|
641
641
|
const { elapsedTime } = useLoadingOvertime({
|
|
642
|
+
...overtimeOptions,
|
|
642
643
|
isLoading: mutation.isLoading,
|
|
643
|
-
interval: overtimeOptions?.interval,
|
|
644
|
-
onInterval: overtimeOptions?.onInterval,
|
|
645
644
|
});
|
|
646
645
|
|
|
647
646
|
// this function is used to make the `variables` parameter optional
|
|
@@ -676,9 +676,8 @@ export const useUpdateMany = <
|
|
|
676
676
|
const { mutate, mutateAsync, ...mutation } = mutationResult;
|
|
677
677
|
|
|
678
678
|
const { elapsedTime } = useLoadingOvertime({
|
|
679
|
+
...overtimeOptions,
|
|
679
680
|
isLoading: mutation.isLoading,
|
|
680
|
-
interval: overtimeOptions?.interval,
|
|
681
|
-
onInterval: overtimeOptions?.onInterval,
|
|
682
681
|
});
|
|
683
682
|
|
|
684
683
|
// this function is used to make the `variables` parameter optional
|
package/src/hooks/form/index.ts
CHANGED
|
@@ -169,14 +169,17 @@ export const useForm = <
|
|
|
169
169
|
liveParams: props.liveParams,
|
|
170
170
|
meta: { ...combinedMeta, ...props.queryMeta },
|
|
171
171
|
dataProviderName: props.dataProviderName,
|
|
172
|
+
overtimeOptions: { enabled: false },
|
|
172
173
|
});
|
|
173
174
|
|
|
174
175
|
const createMutation = useCreate<TResponse, TResponseError, TVariables>({
|
|
175
176
|
mutationOptions: props.createMutationOptions,
|
|
177
|
+
overtimeOptions: { enabled: false },
|
|
176
178
|
});
|
|
177
179
|
|
|
178
180
|
const updateMutation = useUpdate<TResponse, TResponseError, TVariables>({
|
|
179
181
|
mutationOptions: props.updateMutationOptions,
|
|
182
|
+
overtimeOptions: { enabled: false },
|
|
180
183
|
});
|
|
181
184
|
|
|
182
185
|
const mutationResult = isEdit ? updateMutation : createMutation;
|
|
@@ -184,9 +187,8 @@ export const useForm = <
|
|
|
184
187
|
const formLoading = isMutationLoading || queryResult.isFetching;
|
|
185
188
|
|
|
186
189
|
const { elapsedTime } = useLoadingOvertime({
|
|
190
|
+
...props.overtimeOptions,
|
|
187
191
|
isLoading: formLoading,
|
|
188
|
-
interval: props.overtimeOptions?.interval,
|
|
189
|
-
onInterval: props.overtimeOptions?.onInterval,
|
|
190
192
|
});
|
|
191
193
|
|
|
192
194
|
React.useEffect(() => {
|
package/src/hooks/show/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import warnOnce from "warn-once";
|
|
2
|
-
import { useMeta, useOne, useResourceParams
|
|
2
|
+
import { useMeta, useOne, useResourceParams } from "@hooks";
|
|
3
3
|
import { pickNotDeprecated } from "@definitions/helpers";
|
|
4
4
|
|
|
5
5
|
import type { UseShowProps, UseShowReturnType } from "./types";
|
|
@@ -71,21 +71,16 @@ export const useShow = <
|
|
|
71
71
|
},
|
|
72
72
|
meta: combinedMeta,
|
|
73
73
|
metaData: combinedMeta,
|
|
74
|
+
overtimeOptions,
|
|
74
75
|
...useOneProps,
|
|
75
76
|
});
|
|
76
77
|
|
|
77
|
-
const { elapsedTime } = useLoadingOvertime({
|
|
78
|
-
isLoading: queryResult.isFetching,
|
|
79
|
-
interval: overtimeOptions?.interval,
|
|
80
|
-
onInterval: overtimeOptions?.onInterval,
|
|
81
|
-
});
|
|
82
|
-
|
|
83
78
|
return {
|
|
84
79
|
queryResult,
|
|
85
80
|
query: queryResult,
|
|
86
81
|
showId,
|
|
87
82
|
setShowId,
|
|
88
|
-
overtime:
|
|
83
|
+
overtime: queryResult.overtime,
|
|
89
84
|
};
|
|
90
85
|
};
|
|
91
86
|
|
|
@@ -27,6 +27,13 @@ type UseLoadingOvertimeCoreReturnType = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export type UseLoadingOvertimeCoreProps = {
|
|
30
|
+
/**
|
|
31
|
+
* If true, the elapsed time will be calculated. If set to false; the elapsed time will be `undefined`.
|
|
32
|
+
*
|
|
33
|
+
* @default: true
|
|
34
|
+
*/
|
|
35
|
+
enabled?: boolean;
|
|
36
|
+
|
|
30
37
|
/**
|
|
31
38
|
* The loading state. If true, the elapsed time will be calculated.
|
|
32
39
|
*/
|
|
@@ -63,6 +70,7 @@ export type UseLoadingOvertimeCoreProps = {
|
|
|
63
70
|
* });
|
|
64
71
|
*/
|
|
65
72
|
export const useLoadingOvertime = ({
|
|
73
|
+
enabled: enabledProp,
|
|
66
74
|
isLoading,
|
|
67
75
|
interval: intervalProp,
|
|
68
76
|
onInterval: onIntervalProp,
|
|
@@ -75,11 +83,17 @@ export const useLoadingOvertime = ({
|
|
|
75
83
|
// pick props or refine context options
|
|
76
84
|
const interval = intervalProp ?? overtime.interval;
|
|
77
85
|
const onInterval = onIntervalProp ?? overtime?.onInterval;
|
|
86
|
+
const enabled =
|
|
87
|
+
typeof enabledProp !== "undefined"
|
|
88
|
+
? enabledProp
|
|
89
|
+
: typeof overtime.enabled !== "undefined"
|
|
90
|
+
? overtime.enabled
|
|
91
|
+
: true;
|
|
78
92
|
|
|
79
93
|
useEffect(() => {
|
|
80
94
|
let intervalFn: ReturnType<typeof setInterval>;
|
|
81
95
|
|
|
82
|
-
if (isLoading) {
|
|
96
|
+
if (enabled && isLoading) {
|
|
83
97
|
intervalFn = setInterval(() => {
|
|
84
98
|
// increase elapsed time
|
|
85
99
|
setElapsedTime((prevElapsedTime) => {
|
|
@@ -93,11 +107,13 @@ export const useLoadingOvertime = ({
|
|
|
93
107
|
}
|
|
94
108
|
|
|
95
109
|
return () => {
|
|
96
|
-
|
|
110
|
+
if (typeof intervalFn !== "undefined") {
|
|
111
|
+
clearInterval(intervalFn);
|
|
112
|
+
}
|
|
97
113
|
// reset elapsed time
|
|
98
114
|
setElapsedTime(undefined);
|
|
99
115
|
};
|
|
100
|
-
}, [isLoading, interval]);
|
|
116
|
+
}, [isLoading, interval, enabled]);
|
|
101
117
|
|
|
102
118
|
useEffect(() => {
|
|
103
119
|
// call onInterval callback
|
|
@@ -303,6 +303,7 @@ export const useSelect = <
|
|
|
303
303
|
defaultValueQueryOptions?.onSuccess?.(data);
|
|
304
304
|
},
|
|
305
305
|
},
|
|
306
|
+
overtimeOptions: { enabled: false },
|
|
306
307
|
meta: combinedMeta,
|
|
307
308
|
metaData: combinedMeta,
|
|
308
309
|
liveMode: "off",
|
|
@@ -341,6 +342,7 @@ export const useSelect = <
|
|
|
341
342
|
queryOptions?.onSuccess?.(data);
|
|
342
343
|
},
|
|
343
344
|
},
|
|
345
|
+
overtimeOptions: { enabled: false },
|
|
344
346
|
successNotification,
|
|
345
347
|
errorNotification,
|
|
346
348
|
meta: combinedMeta,
|
|
@@ -352,9 +354,8 @@ export const useSelect = <
|
|
|
352
354
|
});
|
|
353
355
|
|
|
354
356
|
const { elapsedTime } = useLoadingOvertime({
|
|
357
|
+
...overtimeOptions,
|
|
355
358
|
isLoading: queryResult.isFetching || defaultValueQueryResult.isFetching,
|
|
356
|
-
interval: overtimeOptions?.interval,
|
|
357
|
-
onInterval: overtimeOptions?.onInterval,
|
|
358
359
|
});
|
|
359
360
|
|
|
360
361
|
const combinedOptions = useMemo(
|
|
@@ -44,10 +44,9 @@ import type {
|
|
|
44
44
|
import type { LiveModeProps } from "../../contexts/live/types";
|
|
45
45
|
import type { SuccessErrorNotification } from "../../contexts/notification/types";
|
|
46
46
|
import type { BaseListProps } from "../data/useList";
|
|
47
|
-
import {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
useLoadingOvertime,
|
|
47
|
+
import type {
|
|
48
|
+
UseLoadingOvertimeOptionsProps,
|
|
49
|
+
UseLoadingOvertimeReturnType,
|
|
51
50
|
} from "../useLoadingOvertime";
|
|
52
51
|
|
|
53
52
|
type SetFilterBehavior = "merge" | "replace";
|
|
@@ -510,6 +509,7 @@ export function useTable<
|
|
|
510
509
|
? unionSorters(preferredPermanentSorters, sorters)
|
|
511
510
|
: undefined,
|
|
512
511
|
queryOptions,
|
|
512
|
+
overtimeOptions,
|
|
513
513
|
successNotification,
|
|
514
514
|
errorNotification,
|
|
515
515
|
meta: combinedMeta,
|
|
@@ -571,12 +571,6 @@ export function useTable<
|
|
|
571
571
|
[preferredPermanentSorters],
|
|
572
572
|
);
|
|
573
573
|
|
|
574
|
-
const { elapsedTime } = useLoadingOvertime({
|
|
575
|
-
isLoading: queryResult.isFetching,
|
|
576
|
-
interval: overtimeOptions?.interval,
|
|
577
|
-
onInterval: overtimeOptions?.onInterval,
|
|
578
|
-
});
|
|
579
|
-
|
|
580
574
|
return {
|
|
581
575
|
tableQueryResult: queryResult,
|
|
582
576
|
tableQuery: queryResult,
|
|
@@ -594,8 +588,6 @@ export function useTable<
|
|
|
594
588
|
? Math.ceil((queryResult.data?.total ?? 0) / pageSize)
|
|
595
589
|
: 1,
|
|
596
590
|
createLinkForSyncWithLocation,
|
|
597
|
-
overtime:
|
|
598
|
-
elapsedTime,
|
|
599
|
-
},
|
|
591
|
+
overtime: queryResult.overtime,
|
|
600
592
|
};
|
|
601
593
|
}
|