8000 `xpath/select-all` shouldn't be evaluated lazily · Issue #46 · active-group/reacl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
xpath/select-all shouldn't be evaluated lazily  #46
Open
@smoes

Description

@smoes

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0