Fork me on GitHub

Is it ok for two different components to have the same ident?


I think it is OK


the indexer appears to keep a map from idents to sets of components


also it seems necessary


@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


i think React is doing the key warning logic in the wrong place in their engine


@hlolli: @nxqd : here is a codepen that demonstrates:


as you can see react complains about keys, even though it has no problem sorting it out in reality (try typing in the fields)


oh wait, i think i made it mess up (it looses focus)


so i guess it is warning correctly, the diff is just not very smart


@hlolli I have had success doing this for Sablono (sab/html [:div (into [:ul.mylist] (map (fn [x] [:li.myitem x]) list-items))])


Did tempid handling change from alpha31 to 32?


@tony.kay: not that I’m aware


yeah, I see you made sure to merge queries


ok...probably just a weirdness on my end


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.