{"action":"opened","issue":{"url":"https://api.github.com/repos/omcljs/om/issues/825","repository_url":"https://api.github.com/repos/omcljs/om","labels_url":"https://api.github.com/repos/omcljs/om/issues/825/labels{/name}","comments_url":"https://api.github.com/repos/omcljs/om/issues/825/comments","events_url":"https://api.github.com/repos/omcljs/om/issues/825/events","html_url":"https://github.com/omcljs/om/issues/825","id":189491323,"number":825,"title":"merge! behavior when add-root! called with nil target","user":{"login":"calvis","id":1058897,"avatar_url":"https://avatars.githubusercontent.com/u/1058897?v=3","gravatar_id":"","url":"https://api.github.com/users/calvis","html_url":"https://github.com/calvis","followers_url":"https://api.github.com/users/calvis/followers","following_url":"https://api.github.com/users/calvis/following{/other_user}","gists_url":"https://api.github.com/users/calvis/gists{/gist_id}","starred_url":"https://api.github.com/users/calvis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calvis/subscriptions","organizations_url":"https://api.github.com/users/calvis/orgs","repos_url":"https://api.github.com/users/calvis/repos","events_url":"https://api.github.com/users/calvis/events{/privacy}","received_events_url":"https://api.github.com/users/calvis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-15T20:01:01Z","updated_at":"2016-11-15T20:01:01Z","closed_at":null,"body":"I'm seeing different results for `merge!` after an `add-root!` when the target is a dom element vs. `nil`.  This is not intuitive & is making testing hard, so I'm hoping it's a bug.\r\n\r\n```clj\r\n(ns frustration.core\r\n  (:require [goog.dom :as gdom]\r\n            [om.next :as om :refer-macros [defui]]\r\n            [om.dom :as dom :include-macros true]))\r\n\r\n(enable-console-print!)\r\n\r\n(defui ThingWithIdent\r\n  static om/Ident\r\n  (ident [this {:keys [id]}]\r\n    [:id id])\r\n  static om/IQuery\r\n  (query [this]\r\n    '[:id])\r\n  Object\r\n  (render [this] (dom/div {} (str (:id (om/props this))))))\r\n\r\n(def thing (om/factory ThingWithIdent {:keyfn id}))\r\n\r\n(defui RootView\r\n  static om/IQuery\r\n  (query [this]\r\n    [{:list (om/get-query ThingWithIdent)}])\r\n  Object\r\n  (render [this]\r\n    (let [{:keys [list]} (om/props this)]\r\n      (apply dom/div {} (map thing list)))))\r\n\r\n(defmulti read om/dispatch)\r\n\r\n(defmethod read :list\r\n  [{:keys [state query] :as env} key params]\r\n  (let [st @state]\r\n    {:value (om/db->tree query (get st key) st)}))\r\n\r\n(comment\r\n  (def reconciler1\r\n    (om/reconciler {:state  {:list []}\r\n                    :parser (om/parser {:read read})}))\r\n\r\n  (om/add-root! reconciler1\r\n                RootView\r\n                (gdom/getElement \"app\"))\r\n\r\n  (def reconciler2\r\n    (om/reconciler {:state  {:list []}\r\n                    :parser (om/parser {:read read})}))\r\n\r\n  (om/add-root! reconciler2\r\n                RootView\r\n                nil)\r\n\r\n  (om/merge! reconciler1\r\n             {:list [{:id \"an-id\"}]})\r\n  ;;=> {:list [[:id \"an-id\"]], :id {\"an-id\" {:id \"an-id\"}}, :om.next/tables #{:id}}\r\n  (om/merge! reconciler2\r\n             {:list [{:id \"an-id\"}]})\r\n  ;;=> {:list [{:id \"an-id\"}], :om.next/tables #{}}\r\n  )\r\n```"}}
{"actor":{"display_login":"calvis"}}