omcljs / om

ClojureScript interface to Facebook's React
6.66k stars 363 forks source link

Parser doesn't recurse with bounded recursion #856

Open Peeja opened 7 years ago

Peeja commented 7 years ago

Using ..., the parser recurses the query as the query in the env. Using an integer for bounded recursion, it doesn't.

(let [p (om/parser {:read (fn [{:keys [query]} _ _]
                            {:value {:query query}})})]
  (prn (p {} [{:abc [:def]}] nil))
  (prn (p {} [{:abc '...}] nil))
  (prn (p {} [{:abc 5}] nil)))

;; Prints:
;; {:abc {:query [:def]}}
;; {:abc {:query [{:abc ...}]}}
;; {:abc {:query 5}}

;; Expected
;; {:abc {:query [:def]}}
;; {:abc {:query [{:abc ...}]}}
;; {:abc {:query [{:abc 4}]}}