reagent-project / reagent

A minimalistic ClojureScript interface to React.js
http://reagent-project.github.io/
MIT License
4.75k stars 415 forks source link

Precisely clarify when Reactions send/receive changes #578

Closed shaunlebron closed 2 years ago

shaunlebron commented 2 years ago

Fixes #574

I did a deep study on how the Reaction object sends and receives changes. It was hard to discern the meaning of the accreted branches of logic, so I hope this refactor clarifies how everything is actually working. No behavior changes were made.

  1. Corrected the “Changed?” docs (ratoms are not = tested as was indicated).
  2. Isolate the dirty? conditions so it’s easier to see what it’s preventing.
  3. Isolate the identical? and = to clarify the change detections.
  4. Added a _set-state to Reaction so the change detection from -deref and _run can be shared.
CleanShot 2022-08-29 at 21 24 14@2x