freactive.core
freactive.core copied to clipboard
Inconsistencies in freactive lens-cursor and cursor behavior
Please see the code in this gist: https://gist.github.com/sparkofreason/25845cd249af4188a75f
Here's the output:
lc: {:c 2, :d 3}
b(lens-cursor): (assoc! state :b {:c ...})
b(lens-cursor): (reset! state {:a 2 :b {:c ...}})
b(lens-cursor): (reset! state {:a 2 :b {:c ...}})
Seems to be two related issues here. First, a child cursor derived from a lens-cursor containing a map doesn't seem to get notified the same as a child lens-cursor derived from a lens-cursor. Similarly, there is different child notification behavior whether we assoc! into the root atom, or just reset! the whole atom.
I get this output:
lc: {:c 2, :d 3}
b(lens-cursor): (assoc! state :b {:c ...})
b(lens-cursor): (reset! state {:a 2 :b {:c ...}})
b(cursor): (reset! state {:a 2 :b {:c ...}})
Is this what you get? Still we're not seeing anything for b(cursor): (assoc! state :b {:c ...}) as would be expected.
Sorry, copy/paste error. I get the same output as you.
Probably closely related: calling assoc! on a lens-cursor containing a map does not trigger notifications. Using swap! will fire notifications.