diff --git a/app/models/CocoModel.coffee b/app/models/CocoModel.coffee index 919d9a6b9..3f4c9455c 100644 --- a/app/models/CocoModel.coffee +++ b/app/models/CocoModel.coffee @@ -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() diff --git a/app/views/editor/thang/edit.coffee b/app/views/editor/thang/edit.coffee index a8310cdf2..833ce3e0e 100644 --- a/app/views/editor/thang/edit.coffee +++ b/app/views/editor/thang/edit.coffee @@ -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