 
 (dispatch/react-to #{:document-changed}
                    (fn [_ d]
-                     (if (not= (:document @state) d)
+                     (if (not= (:document @state) (:id d))
                        (list-documents @docs))))

(defn- add-item-listeners! []
  (doseq [item (nodes ($ "#sidebar-documents > ol > li"))]
    (let [$bookmark ($ "a.bookmark" item)
          $delete   ($ "button.delete" item)]
      (event/listen $bookmark
                    CLICK
                    (fn [e] (.preventDefault e)))
      (event/listen $delete
                    CLICK
                    (fn [e]
                      (.stopPropagation e)
                      (remove-document (.getAttribute item "docid"))))
      (event/listen item
                    CLICK
                    (fn [e]
                      (dispatch/fire :document-requested
                                     (.getAttribute item "docid")))))))

(defpartial document-list-item [{:keys [id content ts title]}]
  [:li {:docid id}
   [:button.delete]
   [:div.excerpt
    [:span (or title (excerpt content 20))]]
   [:div.document-id
    [:span [:a.bookmark {:href (str \# id)}
            (.toString (js/Date. ts))]]]])

(defn- append-list-items! [target items]
  (doseq [item items]

            [goog.editor.Field         :as editor-iframe]
            [goog.editor.SeamlessField :as editor-div]
            [one.dispatch              :as dispatch]
            [crate.core                :as crate]
            [dates                     :as dates]))

(def CHANGE    goog.editor.Field.EventType.DELAYEDCHANGE)
(def CLICK     goog.events.EventType.CLICK)
(def BLUR      goog.events.EventType.BLUR)
(def MOUSEOVER goog.events.EventType.MOUSEOVER)

(defn- strip-html [s]
  (-> s
