           timer (timeout ms)
           [new-val ch] (alts! [in timer])]
       (condp = ch
-        timer (do (swap! state assoc :suggestions (<! (suggest-fn val)))
+        timer (do (swap! state assoc :suggestions  (<! (suggest-fn val)))
                   (recur nil))
         in (when new-val (recur new-val))))))
 

  (let [state (r/atom {:current-text nil
                       :focused false
                       :suggestions []})

        on-change-ch (chan)
        handle-input-change
        (fn [event]

           [:input {:type "text"
                    :on-change handle-input-change
                    :on-focus #(swap! state assoc :focused true)
                    :value (or (:current-text @state)
                               (match-fn value))}]

           (when (and (:focused @state) (not (empty? (:suggestions @state))))
             [:div.suggestions
              (for [i (:suggestions @state)] ^{:key (pr-str (value-fn i))}
                [:div.option {:on-click #(do (when on-change (on-change (value-fn i)))
                                             (close))}
                 (label-fn i)])])]))})))
