                       :onChange #(toggle-all % todos)})
       (dom/ul #js {:id "todo-list"}
         (into-array
-          (map #(om/render item/todo-item todos [%] opts :id)
+          (map #(om/render item/todo-item todos
+                  {:path [%]
+                   :opts opts
+                   :key :id
+                   :fn (fn [todo]
+                         (if (= (:id todo) (:editing opts))
+                           (assoc todo :editing true)
+                           todo))})
             (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 [:todos]
              {:chans chans :editing (:editing app)})
            (om/render footer app []
              {:active active :completed completed
               :chans chans :showing :all})))))))

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


    (into [] (filter #(= (:id %) id) (:todos app)))))

(defn edit-todo [app todo]
  (om/replace! app [:editing] (:id todo)))

(defn save-todo [todo text]
  (om/replace! todo (update-in todo [:title] text)))
