rum

Simple, decomplected, isomorphic HTML UI library for Clojure and ClojureScript | 0.12.8 https://github.com/tonsky/rum/blob/gh-pages/CHANGELOG.md#0128
cheatex 2018-12-07T08:17:29.011900Z

Is it ok to read component's arguments in a trait? How can I idiomatically extract them from a state?

cheatex 2018-12-07T08:19:50.013700Z

I've ended up having few helper functions looking like:

(defn focus-when-selected [{args :rum/args :as state}]
  (let [[item _] args]
    (when (:selected item)
      (.focus (rum/ref-node state ::name-input))))
  state)
and

cheatex 2018-12-07T08:20:51.014300Z

use them like

(rum/defcs edit-c <
           { :did-mount focus-when-selected,
             :did-update focus-when-selected }
           [state item actions]

cheatex 2018-12-07T08:49:19.015700Z

A quick improvement idea. Emit warning when a trait function returns nil

2018-12-07T16:38:20.018500Z

hello guys! i'am pretty new to rum 🙂 I tried using cursors and found that view (rum/static, rum/reactive) seems not to be updated when i modify meta of cursor data with vary-meta. is it ok? or what am i doing wrong?

2018-12-07T16:42:52.019800Z

i am trying to use meta data to store things like loading and error flags, etc.

Jan K 2018-12-08T14:35:50.020200Z

you shouldn't be using metadata for that.

2018-12-08T16:19:11.020400Z

why not?

2018-12-08T16:21:58.020600Z

it's convinient to put such things in meta other then have tree like {:users {:data [...], :loading? false, has-more? true}}. Does not it?

Jan K 2018-12-08T16:43:35.020800Z

If your UI cares about those things, that's a sign to me that it should be data, not metadata. I find it's better to avoid using metadata unless you're doing some crazy macro stuff.

2018-12-08T16:58:19.021Z

makes sense