         [:form.card-search {:on-submit #(handle-add owner %)}
          [:input.lookup {:type "text" :placeholder "Card" :value (:query state)
                          :on-change #(om/set-state! owner :query (.. % -target -value))
-                         :on-key-down #(handle-keydown owner %)
-                         :on-blur #(om/set-state! owner :matches [])}] " x "
+                         :on-key-down #(handle-keydown owner %)}]
+         " x "
          [:input.qty {:type "text" :value (:quantity state)
                       :on-change #(om/set-state! owner :quantity (.. % -target -value))}]
          [:button "Add to deck"]

    om/IInitState
    (init-state [this]
      {:edit false
       :add-channel (chan)
       :deck nil})

    om/IWillMount
    (will-mount [this]
      (let [add-channel (om/get-state owner :add-channel)]
        (go (while true
              (let [line (<! add-channel)]
                ;; (println line)
                (-> ".deckedit textarea" js/$ (.append line))
                (handle-edit owner))))))

    om/IDidUpdate
    (did-update [this prev-props prev-state]


(defn handle-add [owner event]
  (.preventDefault event)
  (put! (om/get-state owner :edit-channel)
        {:qty (js/parseInt (om/get-state owner :quantity))
         :card (first (om/get-state owner :matches))})
  (om/set-state! owner :quantity 3)
  (om/set-state! owner :query "")
  (-> ".deckedit .lookup" js/$ .focus))
