omcljs / om

ClojureScript interface to Facebook's React
6.66k stars 362 forks source link

om.next/default-merge looks for :tempids keyval in the wrong place #868

Open solussd opened 7 years ago

solussd commented 7 years ago

default-merge doesn't look in the :results map of a mutation response for a `:tempids key (instead looks one level higher).

anmonteiro commented 7 years ago

This is done on purpose. Your response can have the result of multiple mutations, it's your job to lift the tempids key one level higher on the server.

solussd commented 7 years ago

I'm not sure I understand– 

the response has the form: {some/action {:result {:tempids ...}}}

Each action could potentially have its own result and own tempids map. If I moved the :tempids map-entry up to the same level as result, how does that relate to multiple mutations?

anmonteiro commented 7 years ago

I mean you're responsible to pull all the tempids to the toplevel of the response and merge them together.

solussd commented 7 years ago

default-merge doesn't look at the top level. It looks at the keyval for each action.

anmonteiro commented 7 years ago

Ooops, I guess I had a wrong assumption. I don't know why it's done that way then, but I vaguely remember some discussion on Slack about this.