                     text: item.label
                     url: item.url
               callback(data)
-          )
+          ).always ->
+            loading = false
 
     @dropdown.addClass('open')
     @searchInput.removeClass('disabled')

    @dropdown.dropdown('toggle')

  onSearchInputKeyDown: (e) =>
    # Remove tag when pressing backspace and input search is empty
    if e.keyCode is KEYCODE.BACKSPACE and e.currentTarget.value is ''
      @removeLocationBadge()
      @searchInput.focus()

    else if e.keyCode is KEYCODE.ESCAPE
      @searchInput.val('')
      @restoreOriginalState()
    else
      # Create new autocomplete if it hasn't been created yet and there's no badge
      if @autocomplete is undefined
        if !@badgePresent()
          @enableAutocomplete()
      else
        # There's a badge
        if @badgePresent()
          @disableAutocomplete()

  onSearchInputFocus: =>
    @wrap.addClass('search-active')

    @resetSearchState()

  disableAutocomplete: ->
    if @autocomplete
      @searchInput.addClass('disabled')
    @autocomplete = false
