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

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

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

ES6 simplified code would be,

this.collectionPages = [...this.collectionPages, collectionPageDbModel]

Leave a Comment