Matterway
    Preparing search index...

    Function useComputedItems

    • Hook to compute items from either a static array or a dynamic function. Prevents infinite render loops by:

      1. Storing the items function in a ref (avoids re-triggers on function reference changes)
      2. Using JSON.stringify signatures for stable dependencies (only re-evaluates when data actually changes)

      Type Parameters

      • T

      Parameters

      • items:
            | T[]
            | (
                (
                    params: { data: Record<string, unknown>; value: any },
                ) => T[] | Promise<T[]>
            )
            | undefined

        Static array or function that returns array of items

      • state: Record<string, unknown>

        The global UI state object

      • stateValue: any

        The current field value (derived from state[name])

      Returns T[] | undefined

      The computed items array or undefined