In the following example the behavior of xpath/select-all seems unintuitive because of lazyness:
(let [comp (tu/mount a-div-containing-component)
divs-before (xpath/select-all comp (xpath/>> ** "div"))
comp (send-message!! comp :destroy-all-divs)]
(assert (pos? (count divs-before))))
Assuming the div-containing-component contains at least one div before sending the message and zero after. divs-before returns an empty list, since the query is evaluated after all divs where destroyed. That said, the assertion will fail. Wrapping it in (doall (xpath/select-all ...)) fixes the problem.
I'd expect xpath/select-all to be evaluated eagerly.
In the following example the behavior of
xpath/select-allseems unintuitive because of lazyness:Assuming the
div-containing-componentcontains at least one div before sending the message and zero after.divs-beforereturns an empty list, since the query is evaluated after all divs where destroyed. That said, the assertion will fail. Wrapping it in(doall (xpath/select-all ...))fixes the problem.I'd expect
xpath/select-allto be evaluated eagerly.