Last active
August 29, 2015 14:23
-
-
Save sparkofreason/25845cd249af4188a75f to your computer and use it in GitHub Desktop.
Inconsistencies in freactive lens-cursor and cursor behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns freactive-sandbox.rx-test | |
(:require-macros [freactive.macros :refer [rx debug-rx]]) | |
(:require [freactive.core :refer [atom cursor lens-cursor]] | |
[freactive.dom :as dom])) | |
(enable-console-print!) | |
(def state (atom {:a 1 :b {:c 2 :d 3}})) | |
(def lc | |
(lens-cursor state :b)) | |
(println "lc:" @lc) | |
(def b1 (cursor lc :c)) | |
(add-watch b1 :b1 #(println "b(cursor):" %4)) | |
(def b2 (lens-cursor lc :c)) | |
(add-watch b2 :b2 #(println "b(lens-cursor):" %4)) | |
(assoc! state :b {:c "(assoc! state :b {:c ...})"}) | |
(reset! state {:a 2 :b {:c "(reset! state {:a 2 :b {:c ...}})"}}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment