Fork me on GitHub
#om-next
<
2016-07-20
>
hlolli07:07:57

I had same bug, a workaround was to give one a :keyfn but not the other one.

joseph07:07:36

@mpisanko: thanks, I tried but it does not work. I tried to create two simple components with defui which just contains a div node with a string, and gave them a simple react-key. Then add them to the rootnode, but the warning msg still came out.

joseph07:07:58

(defui Test1
  Object
  (render [this]
    (dom/div nil
           (dom/span nil "ss"))))

(def test1 (om/factory Test1 {:keyfn :test1}))


(defui Test2
  Object
  (render [this]
    (dom/div nil
           (dom/span nil "s2s"))))

(def test2 (om/factory Test2 {:keyfn :test2}))


(defui Dashboard
  static om/IQuery
  (query [this]
    [{:dashboard/items (om/get-query DashboardItem)}])
  Object
  (render [this]
    (let [{:keys [dashboard/items]} (om/props this)]
      (dom/ul
        #js {:style #js {:padding 0}}
        (test1)
        (test2)
        ; (map dashboard-item items)
        ))))

joseph07:07:07

like this....

mpisanko08:07:31

@joseph: as the doco says :keyfn should produce the key for component from its properties - an example can be found here: https://github.com/omcljs/om/wiki/Components,-Identity-&amp;-Normalization#something-to-look-at

joseph09:07:08

yes, right, but does it mean I have to give the :keyfn as react-key for each component, why the others examples like this https://github.com/omcljs/om/wiki/Queries-With-Unions do not apply the :keyfn

mpisanko09:07:30

hmm, also there’s a bug: https://github.com/omcljs/om/issues/673 seems like you’re hitting it.

joseph11:07:07

yes, that's true, so, just wait the fixing...