diff --git a/libs/ngxs/repositories/src/ngxs-data-entity-collections/ngxs-data-entity-collections.repository.ts b/libs/ngxs/repositories/src/ngxs-data-entity-collections/ngxs-data-entity-collections.repository.ts index 6f46dfab8..6f84b059b 100644 --- a/libs/ngxs/repositories/src/ngxs-data-entity-collections/ngxs-data-entity-collections.repository.ts +++ b/libs/ngxs/repositories/src/ngxs-data-entity-collections/ngxs-data-entity-collections.repository.ts @@ -179,6 +179,11 @@ export abstract class AbstractNgxsDataEntityCollectionsRepository< this.setEntitiesState(this.getState()); } + @DataAction() + public patchState(@Payload('patchValue') value: Partial>): void { + this.ctx.patchState(value); + } + public setComparator(comparator: EntityComparator | null): this { this.comparator = comparator; @@ -350,7 +355,7 @@ export abstract class AbstractNgxsDataEntityCollectionsRepository< protected setEntitiesState(state: EntityCollections): void { const ids: K[] = this.sortKeysByComparator(state.ids, state.entities); - this.ctx.setState({ ...state, ids, entities: state.entities }); + this.ctx.patchState({ ...state, ids, entities: state.entities }); } protected sortKeysByComparator(originalIds: K[], entities: EntityDictionary): K[] {