dom-types icon indicating copy to clipboard operation
dom-types copied to clipboard

Laziness & mutable data structure

Open green-coder opened this issue 4 years ago • 0 comments

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 %))))

green-coder avatar Aug 25 '21 15:08 green-coder