     (into [] (filter #(= (:id %) id) (:todos app)))))
 
 (defn edit-todo [app todo]
-  (om/replace! todo [:editing] (:id todo)))
+  (om/replace! app [:editing] (:id todo)))
 
 (defn save-todo [todo text]
   (om/replace! todo (update-in todo [:title] text)))

                      :onChange #(toggle-all % todos)})
      (dom/ul #js {:id "todo-list"}
        (into-array
          (map #(om/render item/todo-item todos [%] opts :id)
            (range (count todos))))))))

(defn footer [{:keys [todos] :as app} opts]

                   :id "new-todo"
                   :placeholder "What needs to be done?"
                   :onKeyDown #(handle-new-todo-keydown % app owner)})
            (om/render main app
              {:path [:todos]
               :opts {:chans chans :editing (:editing app)}})
            (om/render footer app
              {:path []
               :opts {:active active :completed completed
                      :chans chans :showing :all}})))))))

(om/root app-state todo-app (.getElementById js/document "todoapp"))

