            :width          width
            :height         height
            :placeholder    placeholder
-           :on-change #(do (swap! state-atom assoc :input-text %)
-                           (when-not (clojure.string/blank? %)
-                             (put! c-input %)))
+           :on-change      #(do (swap! state-atom change-text-input %) (put! c-input %))
            :change-on-blur? false
            :attr {:on-key-down #(on-key-down state-atom %)}]
           (if (or (not-empty suggestions) waiting?)

  (-> state
      (assoc :waiting? false :suggestions [] :input-text "")
      select-reset))

(defn- search-data-source
  "Call the user-supplied `data-source` fn and put the result on `c-sugg`.

  (swap! state-atom assoc :waiting? true))

(defn- handle-search
  [state-atom c-sugg c-search]
  (go-loop []
    (let [new-text (<! c-search)
          data-source (:data-source @state-atom)]
      (if (= "" new-text)
        (swap! state-atom reset-typeahead)
        (search-data-source data-source state-atom c-sugg new-text))
