mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-06 03:14:39 +08:00
Stop enforcing that every model has an ID - not a big deal anymore because the client can’t save!
This commit is contained in:
parent
43118d78be
commit
5b8672a515
3 changed files with 0 additions and 9 deletions
|
@ -76,16 +76,10 @@ export default class AttributeCollection extends Attribute {
|
||||||
|
|
||||||
if (this.ItemClass.prototype.fromJSON) {
|
if (this.ItemClass.prototype.fromJSON) {
|
||||||
const obj = new this.ItemClass();
|
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);
|
obj.fromJSON(objJSON);
|
||||||
objs.push(obj);
|
objs.push(obj);
|
||||||
} else {
|
} else {
|
||||||
const obj = new this.ItemClass(objJSON);
|
const obj = new this.ItemClass(objJSON);
|
||||||
obj.id = undefined;
|
|
||||||
objs.push(obj);
|
objs.push(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,6 @@ class Model
|
||||||
for key in Object.keys(@constructor.attributes)
|
for key in Object.keys(@constructor.attributes)
|
||||||
continue unless values[key]?
|
continue unless values[key]?
|
||||||
@[key] = values[key]
|
@[key] = values[key]
|
||||||
|
|
||||||
@id ?= Utils.generateTempId()
|
|
||||||
@
|
@
|
||||||
|
|
||||||
isSavedRemotely: ->
|
isSavedRemotely: ->
|
||||||
|
|
|
@ -94,7 +94,6 @@ export default class MutableQueryResultSet extends QueryResultSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
this._modelsHash[item.id] = item;
|
this._modelsHash[item.id] = item;
|
||||||
this._idToIndexHash = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removeModelAtOffset(item, offset) {
|
removeModelAtOffset(item, offset) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue