@umbraco-cms/backoffice

    Function partialUpdateFrozenArray

    • Function

      partialUpdateFrozenArray

      Type Parameters

      • T

      Parameters

      • data: T[]

        Initial data for this Observable.

      • partialEntry: Partial<T>

        New data to be added in this Observable.

      • findMethod: (entry: T) => boolean

        Method to find the data to be updated.

      Returns T[]

      • New data set with the updated entry.
      • Creates a RxJS Observable from RxJS Subject.

      Example: Example append new entry for a ArrayState or a part of UmbDeepState/UmbObjectState it which is an array. Where the key is unique and the item will be updated if matched with existing.

      const partialEntry = {value: 'myValue'};
      const newDataSet = partialUpdateFrozenArray(myState.getValue(), partialEntry, x => x.key === 'myKey');
      myState.setValue(newDataSet);
    MMNEPVFCICPMFPCPTTAAATR