Reducer helpers, selectors, and the subscription paths that make the shape worth having.
Type parameters
Methods
signature
addMany<S>(state, entities): S
Type parameters
Parameters
Returns
S
Adds an entity. Existing ids are left alone — this is not an upsert.
signature
addOne<S>(state, entity): S
Adds an entity. Existing ids are left alone — this is not an upsert.
Type parameters
Parameters
Returns
S
Wildcard across every entity's field, for the loose subscription registry.
Wildcard across every entity's field, for the loose subscription registry.
Parameters
Returns
string
Overload 1
signature
getInitialState(): EntityState<T, Id>
Returns
EntityState<T, Id>
Overload 2
signature
getInitialState<Extra>(extra): EntityState<T, Id> & Extra
Type parameters
Parameters
Returns
EntityState<T, Id> & Extra
Path to one entity, or to a field of it.
signature
pathTo(id, field?): string
Path to one entity, or to a field of it.
Parameters
Returns
string
Type parameters
Parameters
Returns
S
signature
removeMany<S>(state, ids): S
Type parameters
Parameters
Returns
S
signature
removeOne<S>(state, id): S
Type parameters
Parameters
Returns
S
signature
selectAll(state): readonly T[]
Parameters
Returns
readonly T[]
signature
selectById(state, id): undefined | T
Parameters
Returns
undefined | T
signature
selectEntities(state): Readonly<Record<Id, T>>
Parameters
Returns
Readonly<Record<Id, T>>
signature
selectIds(state): readonly Id[]
Parameters
Returns
readonly Id[]
signature
selectTotal(state): number
Parameters
Returns
number
Replaces the whole collection.
signature
setAll<S>(state, entities): S
Replaces the whole collection.
Type parameters
Parameters
Returns
S
signature
setMany<S>(state, entities): S
Type parameters
Parameters
Returns
S
Adds or replaces one entity wholesale.
signature
setOne<S>(state, entity): S
Adds or replaces one entity wholesale.
Type parameters
Parameters
Returns
S
signature
updateMany<S>(state, updates): S
Type parameters
Parameters
Returns
S
Merges changes into one entity. Unknown ids are ignored.
signature
updateOne<S>(state, update): S
Merges changes into one entity. Unknown ids are ignored.
Type parameters
Parameters
Returns
S
signature
upsertMany<S>(state, entities): S
Type parameters
Parameters
Returns
S
Adds, or merges into an existing entity.
signature
upsertOne<S>(state, entity): S
Adds, or merges into an existing entity.
Type parameters
Parameters
Returns
S