ribelo / doxa

The Unlicense
232 stars 8 forks source link

commit stops denorm when it finds a map without an id #28

Open stevebuik opened 2 years ago

stevebuik commented 2 years ago

(dx/create-dx [{:event/id 1
                :name     "Olympics"
                :sports   {:page/id 1                       ; << remove to see bug
                           :total   10
                           :fetched [{:sport/id 2
                                      :name     "Boardercross"}
                                     {:sport/id 3
                                      :name     "Curling"}]}}]
              {::dx/with-diff? true})

while it's easy to workaround by adding fake ids to every map, it would be much less brittle for early users if it could handle a deeply nested commit where some of the maps didn't need/have idents

ribelo commented 2 years ago

doxa allows to hold nested maps. normalization is user-dependent and only those maps that have a key that satisfies the condition (= "id" (name k)) will be considered as entities. this is a feature, not a bug (:

stevebuik commented 2 years ago

I understand the principle but...

if you could allow this without any negative effects, it would make life easier for any dev starting with Doxa and is not fully aware of this restriction.

also, a side effect of the lack of norm is that pull results come back incorrect and the reason for it is not obvious.

feel free to close this if you want. I understand it, just thinking of others