@kayahr/signal
    Preparing search index...

    Interface CreateResourceOptions<T, Init, S>

    Options for creating a resource.

    interface CreateResourceOptions<T, Init = never, S = unknown> {
        equals?: false | ((previous: T | Init, next: T | Init) => boolean);
        initialValue?: Init;
        skip?: (source: S) => boolean;
    }

    Type Parameters

    • T
    • Init = never
    • S = unknown
    Index

    Properties

    equals?: false | ((previous: T | Init, next: T | Init) => boolean)

    Compares the previous and next resource value.

    Returning true suppresses the value update and keeps dependent computations clean. Set this to false to force a value update for every successful load.

    The previous resource value.

    The next resource value.

    True when both values should be treated as equal.

    initialValue?: Init

    The initial resource value visible before the first successful load.

    skip?: (source: S) => boolean

    Returns true when the current source value should skip loading.

    When loading is skipped, the loader is not called, the current resource value stays unchanged, the resource enters Idle state, and any previous resource error is cleared.

    Type Declaration

      • (source: S): boolean
      • Parameters

        • source: S

          The current source value.

        Returns boolean

        True when loading should be skipped for the current source value.