This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-27
Channels
- # aleph (1)
- # aws (2)
- # beginners (69)
- # boot (79)
- # braid-chat (1)
- # cider (221)
- # clara (13)
- # cljs-dev (9)
- # cljs-edn (1)
- # cljsrn (7)
- # clojure (128)
- # clojure-chicago (1)
- # clojure-russia (196)
- # clojure-sanfrancisco (1)
- # clojure-uk (13)
- # clojurescript (166)
- # community-development (2)
- # css (2)
- # cursive (8)
- # datomic (4)
- # emacs (11)
- # hoplon (54)
- # instaparse (2)
- # jobs (16)
- # jobs-discuss (54)
- # jobs-rus (7)
- # luminus (4)
- # off-topic (33)
- # om (37)
- # onyx (8)
- # proton (10)
- # quil (8)
- # re-frame (29)
- # reagent (7)
- # remote-jobs (2)
- # untangled (140)
- # yada (1)
Hello everyone, i have a thing for you all to play with
@onetom: i think you may find this useful
@micha: hey, did you manage to make any progress on https://github.com/hoplon/hoplon/pull/129?
@thedavidmeister: I think that happens because when loop-tpl
recalculates the DOM elements it needs to show, the do! :value
on the element that is unchanged never gets triggered. The new value of the input is in the mutable DOM state, not in any other cell
@dm3 it’s weird that the behaviour is different based on whether the value as a string is the same or different
@dm3: i would have expected that different cell = trigger do!
like, using identical?
or something
what do you mean “added back”?
it seems that you can't just let user update the input without actually propagating these changes into some cells
did i not do that in my example?
+ (div
+ :id "input-list"
+ (let [values (cell {})
+ values+final (cell= (into values {:new nil}))
+ on-input! (fn [id v] (reset! values (->>
+ ; Update values.
+ (merge @values {id v})
+ ; Filter empty strings.
+ (remove #(let [[_ v] %] (= "" v)))
+ ; Ensure we have a map.
+ (into {}))))]
+ (loop-tpl :bindings [[k v] values+final]
+ (let [id (cell= (if (= :new k) (gensym) k))]
+ (input
+ :value v
+ :id id
+ :input #(on-input! @id @%))))))
what would i change here?
i thought :input
is changing values
ah, i added two examples
with a set of tests for each
+(defn- add-remove-inputs!
+ [t]
+ (let [inputs #(elements "#input-list input")
+ nth-input #(nth (inputs) %)
+ [one two three] t]
+ (send-keys (nth-input 0) one)
+ (send-keys (nth-input 1) two)
+ (send-keys (nth-input 2) three)
+ (is (= 4 (count (inputs))))
+ (send-keys (nth-input 0) "\b")
+ (is (= 3 (count (inputs))))
+ (is (= two (value (nth-input 0))))
+ (is (= three (value (nth-input 1))))
+ (is (= "" (value (nth-input 2))))))
so, i gave an example which represents what is actually tripping me up in my project
but simplified a bunch
and then a separate example showing that simply toggling between two states after the user inputs something is enough to show the same behaviour
+(deftest add-remove-inputs-diff
+ (add-remove-inputs! ["a" "b" "c"]))
+
+(deftest add-remove-inputs-same
+ (add-remove-inputs! (let [t "a"] [t t t])))
the diff
example passes, but same
fails
that’s the main thing that convinced me this is probably a bug somewhere
yeah, but the cells are different cells
so my only guess is that “somewhere” two different cells with the same value are treated as identical
so like… =
vs identical?
i suppose
mhmm, i need a hand figuring it out
anyway, g2g
@micha: Im running into the issue again where hoplon task does not see checkout files
nope my bad hl lib was adding files are source not resource