Minor Changes
-
#4523
18d446b1069
Thanks @yildirayunlu! - feat: adduseLoadingOvertime
hook and implement primitive hooksIf you need to do something when the loading time exceeds the specified time, refine provides the
useLoadingOvertime
hook. It returns the elapsed time in milliseconds.const { elapsedTime } = useLoadingOvertime({ isLoading, interval: 1000, onInterval(elapsedInterval) { console.log("loading overtime", elapsedInterval); }, }); console.log(elapsedTime); // 1000, 2000, 3000, ...
This hook implements the primitive data hooks:
-
#4527
ceadcd29fc9
Thanks @salihozdemir! - fix: support multipleresource
usage with the same name via theidentifier
Previously, data hooks only worked with resource name. So if you had multiple
resource
usage with the same name, it would cause issues.Now the following hooks and its derivatives support
identifier
to distinguish between the resources:useList
useInfiniteList
useOne
useMany
useCreate
useCreateMany
useUpdate
useUpdateMany
useDelete
useDeleteMany
fix: generate correct
queryKey
's for queries withidentifier
Previously, the
queryKey
was generated usingname
. This caused issues when you had multipleresource
usage with the same name. Now thequeryKey
's are generated usingidentifier
if it's present. -
#4523
18d446b1069
Thanks @yildirayunlu! - feat: adduseLoadingOvertime
hookif you need to do something when the loading time exceeds the specified time, refine provides the
useLoadingOvertime
hook. It returns the elapsed time in milliseconds.const { elapsedTime } = useLoadingOvertime({ isLoading, interval: 1000, onInterval(elapsedInterval) { console.log("loading overtime", elapsedInterval); }, });
interval
andonInterval
are optional. It can be controlled globally from<Refine />
options.<Refine //... options={{ //... overtime: { interval: 2000, // default 1000 onInterval(elapsedInterval) { console.log( "loading overtime", elapsedInterval, ); }, }, }} >