Fork me on GitHub
#rum
<
2018-01-15
>
chrisblom12:01:34

is there an large open source webapp in using rum? I'd like to study how people write larger apps with rum

chrisblom14:01:58

i have a component that sets the select tag value based on the value of and atom, I'm using rum/react & rum/reactive, but sometimes the element does not update

chrisblom14:01:42

i remember when working with om that there was some workaround needed to update certain input elements, is that the case with rum as well?

chrisblom14:01:26

(rum/defc select < rum/reactive [cursor {:keys [options label]}]
  [:.form-group
   [:label label]
   (into [:select.form-control
          {:value (or (rum/react cursor) "")
           :on-change (fn [dom-event] (reset! cursor (read-string (.. dom-event -target -value))))}]
         (for [ [i o] (map vector (range) options)]
           [:option {:value (pr-str o)} (name o)]))])

justinlee16:01:32

@chrisblom so you are saying that if you log the (read-string... form you’ll receive events that are sometimes not reflected in the ui?

justinlee16:01:39

generally both om and rum have a common problem, which is that because they batch updates, on-change events can get swallowed and cause other kinds of re-renders. supposedly the sablono library that they both rely upon fixes this problem but maybe you found another issue?

chrisblom22:01:57

thanks, the events get swallowed, i've fixed it now by calling rum/request-render

justinlee22:01:31

@chrisblom if you have a small repro you should really file a bug. that shouldn’t be required

chrisblom22:01:00

yeah, i'll see if i can make a minimal testcase

jeroenvandijk16:01:08

@chrisblom I've come across this issue too i think. My solution was to not re-render the select, but rely on the native state and kept the changed value in some other atom

chrisblom08:01:40

the problem was the the native state and the atom get out of sync

Garrett Hopper22:01:20

I'm getting a no such namespace "prum-preact" when trying to use prum. I've tried adding "prum-preact" to :npm-deps, but I'm not having any luck. Any ideas?

Garrett Hopper22:01:30

:install-deps too. (I'm using boot-cljs, btw)