Clojurians
#om-next
<
2016-09-17
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

joseph10:09:41

@mitchelkuijpers hi, i have added the query on the transact!, and add the function to display the message in the shouldComponentUpdate to see if all the related components are updated. but it does not work, only the component which sent the transact updates and printout the message

mitchelkuijpers11:09:06

Could you show me your transact! call?

joseph22:09:13

yes, this is the component

joseph22:09:56

(defui RoundDropDown
  static om/IQuery
  (query
   [_]
   [:rounds :selected-round :update-sidebar-dropdowns :loading])
  Object
  ;; get rounds when loading this component
  (shouldComponentUpdate
    [this next-props next-state]
    (helpers/d "round next props" )
    (not= next-props (om/props this)))
  (render
   [this]
   (let [{:keys [rounds selected-round update-sidebar-dropdowns loading]} (om/props this)
         round (first (filter #(= (:id %) selected-round) rounds))]
     (dom/div #js {:className "panel panel__form-rounds"}
              (dom/div #js {:className "panel__form-button"}
                       (dom/button #js {:className "button"
                                        :onClick #(om/transact!
                                                    this
                                                    `[(form-sidebar/set-dropdown
                                                        {:dropdown-item :rounds})
                                                      :update-sidebar-dropdowns])}
                                   (str (or (:label round) "Select round")
                                        " ")
                                   (dom/span #js {:className "caret"})))))))

joseph22:09:26

the transact is triggered in the click event

#(om/transact!
                                                    this
                                                    `[(form-sidebar/set-dropdown
                                                        {:dropdown-item :rounds})
                                                      :update-sidebar-dropdowns])

joseph22:09:17

and the component contains the query :update-sidebar-dropdown