Fork me on GitHub
#om-next
<
2018-12-22
>
rith8710:12:14

hello, I'm working with some om next code and I'm having the following issue: 1. StructurePage is first rendered when app/current-structure is still loading, so only part of the page is loaded <-- expected 2. all the APIs return and I see the full app/current-structure being populated in the app-state <-- expected 3. StructurePage still only has the app/current-structure that is still loading <-- unexpected code:

(defui StructurePage
  static om/IQuery
  (query [this]
         [{:app/current-structure (om/get-query StructureDetails)}])

  Object
  (render [this]
    (let [details (-> this om/props :app/current-structure)]
      (when-not (empty? details)
        (structure-details (om/computed details
                             {:router (-> this om/get-computed :router)}))))))
debugging output:
(-> (om/class->any reconciler StructurePage) om/props)
{:app/current-structure
 {:id nil,
  :type nil,
  :attributes nil,
  :loading true,
  :updating nil,
  :error nil,
  :relationships nil,
...

(-> reconciler om/app-state deref)
...
 :app/current-structure [:structures "34"],
 :structures
 {"34"
  {:type "structures",
...
any ideas why doesn't the StructurePage sync up with the rest of the app state? FWIW, other observations, - if the StructurePage is first rendered after the structure API call returns, then the page is rendered OK - our reconciler refreshes every 60s. so after 60s, the StructurePage is populated OK and hence rendered fine