This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-17
Channels
- # aws (16)
- # beginners (82)
- # boot (29)
- # cider (43)
- # cljs-dev (90)
- # cljsrn (14)
- # clojure (79)
- # clojure-dev (12)
- # clojure-greece (4)
- # clojure-italy (12)
- # clojure-russia (81)
- # clojure-shanghai (1)
- # clojure-spec (39)
- # clojure-uk (28)
- # clojurescript (159)
- # consulting (1)
- # cursive (16)
- # data-science (6)
- # datomic (18)
- # devops (3)
- # emacs (22)
- # figwheel (1)
- # graphql (15)
- # hoplon (3)
- # jobs (1)
- # jobs-discuss (8)
- # leiningen (1)
- # luminus (6)
- # lumo (1)
- # off-topic (18)
- # om (6)
- # onyx (38)
- # pedestal (30)
- # perun (3)
- # re-frame (38)
- # reagent (8)
- # ring-swagger (2)
- # rum (2)
- # sql (2)
- # unrepl (14)
- # untangled (1)
- # vim (8)
@pesterhazy I found out what was going on. The problem was comming from the MaterialUI TextField component that trigger onChange instantly, before the key composition. (I don't know why yet). By setting a :value @my-text-atom
the component was re-rendered instantly, breaking the key composition. I found a workaround covering my needs: I assign an :id "my-id"
, use :defaultValue
instead of :value
to this TextField and in the onChange handler :
(fn [event new-value]
(-> (.getElementById js/document "my-id")
(aset "value" (.. event -target -value)))
(swap! my-text-atom new-value))
Really dirty… not proud at all 😇 but it does the job until I find a cleaner way.
So it was not really a reagent problem but my needs here are maintream, so maybe someone else will search the Slack archives for something similar.@ggaillard the thing to remember is that reagent does some special tricks to make input fields work
one particular problem is that because reagent batches updates, sometimes typing is too slow
that's for controlled components though - by not using value
you're using an uncontrolled component, which works differently
anyway, reagent's tricks probably need to be applied to 3rd party input fields, like the one from materialui
one thing that people have tried is to use force-update to make keystrokes be registered immediately
I haven't heard about your particular issue before
it seems weird that keys are registered separately (I guess as unicode composed characters?) - is that on linux?