Modules: app/actions/entities/entityActions

All functions in this module are action creators and the return value should be passed to the redux store dispatch() function.

Source:

Methods


addEntities(entities)

Add an object of new entities

Parameters:
Name Type Description
entities object

An object containing new entities. This object should be structured as a map by entity type and then by entity id, like so: { [entityType]: { [entityId]: { }, ... } ... }

Source:

addEntitiesOfType(entities, entityType)

Add an object of new entities that all have the same type.

Parameters:
Name Type Description
entities object

An object containing new entities. The keys of the object are the ids for the entities. The values are the entities themselves. This will overwrite any existing entities in the reducer for that entity type.

entityType string

The entity type of the given entities.

Source:

removeEntities(ids, entityType)

Removes entities from the entity reducer

Parameters:
Name Type Description
ids Array

The ids of the entities to remove

entityType string

The type of the entities to remove

Source:

setEntity(entityType, enitityId, data [, merge])

Sets the data for a single entity. If the entity does not exist, it will be created.

Parameters:
Name Type Argument Default Description
entityType string

The type of entity

enitityId string

The id of the entity

data object

The data to set

merge boolean | function <optional>
false

Indicates if existing data should be replaced or merged. By default, existing data will be replaced. If merge is true, existing and new data will be merged by a simple Object.assign(). merge may also be a function that takes the old and new data, and returns a merge result.

Source:

updateEntities(entityType, data [, predicate])

Updates one or more entities by merging the given data into the entities

note: all matching entities will update to a new object reference, even if the new data is the same as the current data. For performance reasons, make sure not to match more entities than necessary.

Parameters:
Name Type Argument Description
entityType string

The type of the entity to update

data object

The data to merge into the matched entities

predicate object <optional>

An object with properties that should match the entities to update (strict equality). If not given, will update all entities of the given type

Source: