mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-02 08:53:38 -04:00
Made the SuperModel a little bit more clever about handling duplicate loaded models, hopefully fixed #1108.
This commit is contained in:
parent
98752159ca
commit
607a2a133f
2 changed files with 1 additions and 5 deletions
app/models
|
@ -121,6 +121,7 @@ module.exports = class SuperModel extends Backbone.Model
|
||||||
if cachedModel
|
if cachedModel
|
||||||
clone = $.extend true, {}, model.attributes
|
clone = $.extend true, {}, model.attributes
|
||||||
cachedModel.set(clone, {silent: true})
|
cachedModel.set(clone, {silent: true})
|
||||||
|
console.debug "Updated cached model <#{cachedModel.get('name') or cachedModel.getURL()}> with new data"
|
||||||
else
|
else
|
||||||
@registerModel(model)
|
@registerModel(model)
|
||||||
collection
|
collection
|
||||||
|
|
|
@ -13,8 +13,6 @@ module.exports = class ThangType extends CocoModel
|
||||||
initialize: ->
|
initialize: ->
|
||||||
super()
|
super()
|
||||||
@building = {}
|
@building = {}
|
||||||
@setDefaults()
|
|
||||||
@on 'sync', @setDefaults
|
|
||||||
@spriteSheets = {}
|
@spriteSheets = {}
|
||||||
|
|
||||||
## Testing memory clearing
|
## Testing memory clearing
|
||||||
|
@ -24,9 +22,6 @@ module.exports = class ThangType extends CocoModel
|
||||||
# @_previousAttributes.raw = null
|
# @_previousAttributes.raw = null
|
||||||
#setTimeout f, 40000
|
#setTimeout f, 40000
|
||||||
|
|
||||||
setDefaults: ->
|
|
||||||
@resetRawData() unless @get('raw')
|
|
||||||
|
|
||||||
resetRawData: ->
|
resetRawData: ->
|
||||||
@set('raw', {shapes: {}, containers: {}, animations: {}})
|
@set('raw', {shapes: {}, containers: {}, animations: {}})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue