lambdaisland / lambdaisland/dom-types

Laziness & mutable data structure

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.