lambdaisland / lambdaisland/dom-types
Laziness & mutable data structure
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 39
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
About this line:
(register-printer js/DocumentFragment 'js/DocumentFragment #(map hiccupize (.-children %)))
The laziness of the returned sequence means that if the output value is not eagerly consumed in a timely manner, the value might not be consistent with the state of the DOM at a given point in time, because the DOM can be mutated.
To be safe, I suggest to change it to:
(register-printer js/DocumentFragment 'js/DocumentFragment #(seq (mapv hiccupize (.-children %))))
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the register-printer entry shown in the issue and compare the lazy map with the proposed eager mapping over the DocumentFragment children. Verify that the printed result represents a consistent DOM snapshot even when the DOM is mutated before the result is consumed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100