Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OM 877 - Fix db->tree recursive join query on vector value #878

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/om/next.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions src/test/om/next/next_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)))))