This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-22
Channels
- # admin-announcements (7)
- # beginners (56)
- # boot (69)
- # cider (168)
- # cljs-dev (2)
- # clojure (170)
- # clojure-austin (25)
- # clojure-beijing (3)
- # clojure-belgium (2)
- # clojure-france (3)
- # clojure-poland (17)
- # clojure-russia (115)
- # clojure-uk (40)
- # clojurebridge (3)
- # clojurescript (87)
- # cursive (9)
- # datomic (30)
- # dirac (18)
- # editors (3)
- # emacs (14)
- # hoplon (195)
- # immutant (14)
- # jobs (3)
- # jobs-discuss (4)
- # leiningen (11)
- # melbourne (5)
- # mount (42)
- # off-topic (5)
- # om (24)
- # onyx (48)
- # parinfer (53)
- # proton (1)
- # protorepl (2)
- # re-frame (3)
- # reactive (2)
- # reagent (29)
- # rum (5)
- # spacemacs (4)
- # untangled (91)
- # yada (1)
Is it ok for two different components to have the same ident?
@hlolli: regarding react key while using sablono you can do something like this
1. use index as key (map-indexed (fn [x i] [:el {:key i}))
2. use an attr in x as key (map (fn [x] [:el {:key (:attr x)}]))
3. if the element here is a component, you can use keyfn from om.
@nxqd Well, how about uniqueness, I do 2 times map indexed and I have few elements with key 0, 1, 2, 3..etc. But looks like a good solution. But overall, this is only a warning, everything works like it is suppose to. So Im trying to understand (by reading react docs) to why react wants unique keys. And I wonder if sablono library should be set to do this automatically as well.
@hlolli: sab doesn't seem to do it. in react 15, react does restrict key even more agressively. I just try react 15 and have to hold back for the upcoming release, some of the parts don't work with react 15 because of the react key. I believe they do some optimization to flatten the tree so it requires react key to work well.
Regarding the unique, it depends on the element path, as long as it's unique within it's siblings then it's fine. You can use (random-uuid)
if you want
ahh ok, then it isn't a problem with map-indexed. So after a cup of coffee I will fix this error message. Thanks!
@hlolli: @nxqd: what i noticed before is that you can give React two DOMs which will turn into the same actual DOM after flattening, and one will give a warning and one will not
with sablano you seem to get a lot of false warnings because it is less common to bother flattening things
@hlolli: @nxqd : here is a codepen that demonstrates: http://codepen.io/isaksky/pen/jPpYqr
as you can see react complains about keys, even though it has no problem sorting it out in reality (try typing in the fields)
@hlolli I have had success doing this for Sablono (sab/html [:div (into [:ul.mylist] (map (fn [x] [:li.myitem x]) list-items))])
@tony.kay: not that I’m aware
Where are the solutions for the Om Devcards Tutorial ?
hello, i'm trying to implement an om-next remote that talks to a postgresql database. i'm a little confused on something... i have a ui with a simple list of elements with a query like [{:items/list [:id :title]}]
and a button that does [(items/insert {:title "foo"})]
. the mutate function for 'items/insert
simply returns {:remote true}
, and then on the server it returns {:action (fn [] (db/insert params)) :value {:keys [:items/list]}}
. what i expect is when i hit the button, the frontend list updates with the new item, but nothing happens... if i refresh the page i can see the new item. i think what i'm missing is, should the :action
function return a value (which appears to be placed in the :results
key) – what should it return?
I'm in UI_Exercises and stuck on Exercise 4. Declared deletePerson {:onDelete (fn [p] (js/console.log "delete" p))}
in the let binding of PeopleWidget. Passed it to om-person
with (om/computed people deletePerson)
pulled the :onDelete
key with {:keys [onDelete]} (om/get-computed this)
in the let binding of Person. Added it to the button with #js (:onClick #(onDelete name))
and I get nothing. I've referred back to the first UI example with callbacks and played around with it but I am stumped.