       @autorun =>
         renderPlot(differentials, locToSubintervals, locationTree, topLocations)
         @loading.set(false)
-    , 300
-
-  @autorun =>
-    # Update selected tab based on type filters
-    selectedIncidentTypes = @data.selectedIncidentTypes.get()
-    if 'cases' in selectedIncidentTypes and 'deaths' not in selectedIncidentTypes
-      @incidentType.set('cases')
-    else if 'cases' not in selectedIncidentTypes and 'deaths' in selectedIncidentTypes
-      @incidentType.set('deaths')
 
 Template.eventResolvedIncidents.helpers
   activeMode: (value)->


  @autorun =>
    @incidents = EventIncidents.find(@data.filterQuery.get())
    allIncidents = @incidents.fetch()
    @hoveredIntervalClickEvent = null
    incidentType = @incidentType.get()

    @loading.set(true)
    @highlightedLocations.remove({})
    _.delay =>
      allIncidents = allIncidents.filter (i)->
        i.locations.every (l)-> l.featureCode
      differentials = convertAllIncidentsToDifferentials(allIncidents)
      differentials = _.where(differentials, type: incidentType)
      subIntervals = differentailIncidentsToSubIntervals(differentials)
      extendSubIntervalsWithValues(differentials, subIntervals)
      for subInterval in subIntervals

    Template.instance().loading.get()

  disableCases: ->
    not _.findWhere(Template.instance().differentialIncidents.get(),
      type: 'cases'
    )

  disableDeaths: ->
    not _.findWhere(Template.instance().differentialIncidents.get(),
      type: 'deaths'
    )

Template.eventResolvedIncidents.events
  "click .incident-type-selector .cases": (event, instance)->
