Make fetch a no-up if already loaded
This commit is contained in:
@@ -37,11 +37,9 @@ module.exports = class ModController extends BaseController
|
||||
# BaseController Overrides #####################################################################
|
||||
|
||||
onWillRender: ->
|
||||
if not @model.isLoaded then @model.fetch()
|
||||
@model.fetch()
|
||||
if @_storage? then @_storage.register "mod:#{@model.slug}", @model, 'activeVersion'
|
||||
|
||||
@model.on Event.change + ':activeModVersion', (mod, modVersion)=>
|
||||
if modVersion? and not modVersion.isLoaded then modVersion.fetch()
|
||||
@model.on Event.change + ':activeModVersion', (mod, modVersion)=> modVersion.fetch()
|
||||
|
||||
onDidRender: ->
|
||||
@$enabled = @$('td:nth-child(1) input')
|
||||
|
||||
@@ -53,7 +53,10 @@ module.exports = class BaseModel extends Backbone.Model
|
||||
|
||||
# Backbone.Model Overrides #####################################################################
|
||||
|
||||
fetch: ->
|
||||
fetch: (options={})->
|
||||
options.force ?= false
|
||||
return if (@isLoading or @isLoaded) and not options.force
|
||||
|
||||
url = @url()
|
||||
logger.info "#{@constructor.name}.#{@cid} reading from url: #{url}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user