TypeError: Cannot add property 1, object is not extensible↵ at Array.push (<anonymous>)

Make a copy of object using the Object.assign method and try again,

this.collectionPages = Object.assign([], this.collectionPages);
this.collectionPages.push(collectionPageDbModel);

The solution proposed by Daniel certainly works for this case. The reason is Object Descriptors which every JS object have. You can check them out by calling Object.getOwnPropertyDescriptors(obj) and it will work for arrays too since (almost) everything is an object.

NGRX Store Selectors that were most probably used in the question modify object descriptors by using Object.defineProperties(obj). That is done to prevent any mutation of the data in the Store outside of the Reducer (which doesn't mutate state either, just creates a new one).

In general case you have to clone the object that you want to mutate:


import { cloneDeep } from 'lodash'

// ...

constructor(private store: Store<any>) {}

someMethod() {
  let someDataFromTheStore = cloneDeep(this.store.select(selectSomeData))
  someDataFromTheStore.myArray.push('...')
}


Both Object.assign and cloneDeep don't transfer descriptors to the new copy.

Object.getOwnPropertyDescriptors

Object.defineProperties