Fixed a bug with the new race condition fix. Moving the schemas to the application would be good.

This commit is contained in:
Scott Erickson 2014-03-08 13:52:34 -08:00
parent ad6317434d
commit afbe2200a6
2 changed files with 4 additions and 4 deletions

View file

@ -16,6 +16,7 @@ class CocoModel extends Backbone.Model
initialize: ->
super()
@constructor.schema ?= new CocoSchema(@urlRoot)
if not @constructor.className
console.error("#{@} needs a className set.")
@markToRevert()
@ -52,10 +53,8 @@ class CocoModel extends Backbone.Model
@backedUp = {}
loadSchema: ->
unless @constructor.schema
@constructor.schema = new CocoSchema(@urlRoot)
@constructor.schema.fetch()
return if @constructor.schema.loading
@constructor.schema.fetch()
@constructor.schema.once 'sync', =>
@constructor.schema.loaded = true
@addSchemaDefaults()

View file

@ -42,6 +42,7 @@ module.exports = class ThangTypeEditView extends View
@thangType = new ThangType(_id: @thangTypeID)
@thangType.saveBackups = true
@thangType.fetch()
@thangType.loadSchema()
@thangType.schema().once 'sync', @onThangTypeSync, @
@thangType.once 'sync', @onThangTypeSync, @
@refreshAnimation = _.debounce @refreshAnimation, 500