uft
    Preparing search index...

    Type Alias LazyOptions<T>

    type LazyOptions<T> = {
        shouldCache?: (initial: T) => boolean;
        shouldReinitialize?: (current: T) => boolean;
    }

    Type Parameters

    • T
    Index

    Properties

    shouldCache?: (initial: T) => boolean

    A function returning a boolean that determines whether the value should be cached and returned on subsequent calls. Returning true keeps the default behaviour while returning false disables the default lazy behaviour. This function is called only once - when the value is first initialized.

    To decide whether to cache the value on subsequent calls, use LazyOptions.shouldReinitialize instead.

    Warning

    If this function returns false, shouldReinitialize will be ignored.

    shouldReinitialize?: (current: T) => boolean

    A function returning a boolean that determines whether the cached value should be discarded and reinitialized. This function is called every time the lazy function is called to get the value.

    If you want to reinitialize on every call, use LazyOptions.shouldCache instead.