From 793de71b990d4647296819ec54dbbb24026b166c Mon Sep 17 00:00:00 2001 From: Brian Noguchi Date: Mon, 10 Jul 2017 10:50:59 -0700 Subject: [PATCH 1/2] Failing test demonstrating GH-877 --- src/test/om/next/next_test.clj | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/om/next/next_test.clj b/src/test/om/next/next_test.clj index cb4f8413..b5c8f6d3 100644 --- a/src/test/om/next/next_test.clj +++ b/src/test/om/next/next_test.clj @@ -909,3 +909,16 @@ (#'om/extract-static-methods '[Multi (method-a [this arg] :a) (method-a [this] :b)]))))) + +(deftest test-om-877-recursive-edge-case + (let [query [{:tree [:id + :value + {:children '...}]}] + state {:tree {:id 0 :value 42 + :children [{:id 1 :value 43 + :children [{:id 2 :value 99 + :children []}]} + {:id 3 :value 101 + :children []}]}}] + (is (= state + (om/db->tree query state state))))) From d1b4ec13aba0b0430551f70204432bdc24fbfe93 Mon Sep 17 00:00:00 2001 From: Brian Noguchi Date: Mon, 10 Jul 2017 10:52:56 -0700 Subject: [PATCH 2/2] Fix for GH-877 --- src/main/om/next.cljc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/om/next.cljc b/src/main/om/next.cljc index 38396636..e83bb892 100644 --- a/src/main/om/next.cljc +++ b/src/main/om/next.cljc @@ -2107,6 +2107,9 @@ (if-not (nil? joins) (let [join (first joins) [key sel] (util/join-entry join) + sel (if (= key recurse-key) + query + sel) v (get ident key)] (recur (next joins) (assoc ret