github refinedev/refine @refinedev/core@4.24.0

Minor Changes

  • #4523 18d446b1069 Thanks @yildirayunlu! - feat: add useLoadingOvertime hook and implement primitive hooks

    If 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 multiple resource usage with the same name via the identifier

    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 with identifier

    Previously, the queryKey was generated using name. This caused issues when you had multiple resource usage with the same name. Now the queryKey's are generated using identifier if it's present.

  • #4523 18d446b1069 Thanks @yildirayunlu! - feat: add useLoadingOvertime hook

    if 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 and onInterval are optional. It can be controlled globally from <Refine /> options.

    <Refine
        //...
        options={{
            //...
            overtime: {
                interval: 2000, // default 1000
                onInterval(elapsedInterval) {
                    console.log(
                        "loading overtime",
                        elapsedInterval,
                    );
                },
            },
        }}
    >

Don't miss a new refine release

NewReleases is sending notifications on new releases.