-
-
Save txus/90c9a4df121a6ad826b8 to your computer and use it in GitHub Desktop.
Reconciler can't normalize data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defui RootView | |
static om/IQuery | |
(query [this] | |
(let [map-props (om/get-query map-component/MapView)] | |
`[{:map-props ~map-props}]))) | |
(defui MapView | |
static om/IQuery | |
(query [this] | |
(let [cluster-query (om/get-query ClusterView)] | |
`[{:clusters ~cluster-query}]))) | |
(defui ClusterView | |
static om/Ident | |
(ident [this {:keys [id]}] | |
[:cluster/by-id id]) | |
static om/IQuery | |
(query [this] | |
(let [parking-spot-query (om/get-query ParkingSpotView)] | |
`[:id {:parking-spots ~parking-spot-query}])))) | |
(defui ParkingSpotView | |
static om/Ident | |
(ident [this {:keys [id]}] | |
[:parking-spot/by-id id]) | |
static om/IQuery | |
(query [this] | |
[:id :latitude :longitude]))) | |
;; the initial data: | |
(def init-data | |
{:parking-spots [{:id "parkingspot1" :latitude 49.5337868906 :longitude 10.9932439499} | |
{:id "parkingspot2" :latitude 50.0322684609 :longitude 11.472756837} | |
{:id "parkingspot3" :latitude 49.7504798885 :longitude 11.0595198813} | |
{:id "parkingspot4" :latitude 50.0487723441 :longitude 10.059378956}] | |
:clusters [{:id 0 :parking-spots [{:id "parkingspot4"} {:id "parkingspot3"}]} | |
{:id 1 :parking-spots [{:id "parkingspot2"} {:id "parkingspot1"}]}]}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The root query is:
The problem is that the reconciler doesn't seem to normalize the data, even though there are proper
Ident
s in place and the shape of the data seems ok.