GitHub

DaffOperationEntityStateAdapterInterface

An entity state adapter that takes care of managing contextual operation and error state for entities.

import { DaffOperationEntityStateAdapterInterface } from '@daffodil/core/state'
interface DaffOperationEntityStateAdapterInterface<T extends DaffIdentifiable = DaffIdentifiable> {
  list: S
  preload: S
  load: S
  preadd: S
  add: S
  preupdate: S
  update: S
  preremove: S
  remove: S
  operationFailed: S
  resetState: S
  getInitialState: S
  getSelectors: DaffOperationEntityStateSelectors<TRootState, T>
}

Properties

Name Type Description
list S

Stores a list of entities in state and resets them all to stable.

preload S

Optimistically adds a placeholder entity into state if necessary and sets the entity to resolving.

load S

Upserts the entity into state and resets operation state and errors.

preadd S

Adds a placeholder entity into state if placeholderId is specified and sets state to adding.

add S

Adds the entity into state, sets operation state to added, and resets errors.

preupdate S

Sets the entity's operation state to mutating.

update S

Upserts the entity into state, sets operation state to mutated, and resets errors.

preremove S

Sets the entity's operation state to deleting.

remove S

Removes the entity from state.

operationFailed S

Resets the entity's operation state and stores errors on the entity.

resetState S

Resets the entity's operation state to stable.

getInitialState S

Gets an empty entity state.

getSelectors DaffOperationEntityStateSelectors<TRootState, T>

Gets entity selectors.