   componentWillMount: ->
     {courseId} = @props
     ScoresExportActions.load(courseId)
+
+  componentDidUpdate: (prevProps, prevState) ->
+    @setState(finalDownloadUrl: @state.downloadUrl) if @shouldTriggerDownload(prevState, @state)
 
   shouldTriggerDownload: (prevState, currentState) ->
     prevState.tryToDownload and not currentState.tryToDownload and not currentState.downloadHasError and currentState.downloadUrl?


  getInitialState: ->
    downloadUrl: null
    lastExported: null
    tryToDownload: false
    downloadedSinceLoad: false

      tryToDownload: false
      downloadUrl: downloadUrl
      lastExported: lastExported
      finalDownloadUrl: null

    @setState(downloadState)

  addBindListener: ->
    {courseId} = @props
