Stop enforcing that every model has an ID - not a big deal anymore because the client can’t save!

This commit is contained in:
Ben Gotow 2017-07-06 12:14:44 -07:00
parent 43118d78be
commit 5b8672a515
3 changed files with 0 additions and 9 deletions

View file

@ -76,16 +76,10 @@ export default class AttributeCollection extends Attribute {
if (this.ItemClass.prototype.fromJSON) {
const obj = new this.ItemClass();
// Important: if no ids are in the JSON, don't make them up
// randomly. This causes an object to be "different" each time it's
// de-serialized even if it's actually the same, makes React
// components re-render!
obj.id = undefined;
obj.fromJSON(objJSON);
objs.push(obj);
} else {
const obj = new this.ItemClass(objJSON);
obj.id = undefined;
objs.push(obj);
}
}

View file

@ -38,8 +38,6 @@ class Model
for key in Object.keys(@constructor.attributes)
continue unless values[key]?
@[key] = values[key]
@id ?= Utils.generateTempId()
@
isSavedRemotely: ->

View file

@ -94,7 +94,6 @@ export default class MutableQueryResultSet extends QueryResultSet {
}
this._modelsHash[item.id] = item;
this._idToIndexHash = null;
}
removeModelAtOffset(item, offset) {