Fork me on GitHub
#fulcro
<
2022-06-04
>
cl_j04:06:04

Hi, eveyone, how to write batch query in df/load!? I tried something like below, got the error Assert failed: (or (eql/ident? server-property-or-ident) (keyword? server-property-or-ident))

(defsc File
  [_ _]
  {:ident :file/key
   :query [:file/key :file/name]})

(df/load!
  app
  [[:file/key k1] [:file/key k2]]
  File
  {:ok-action (fn [env]
                ;; update state here
                ))}

lgessler15:06:18

Arg 2 must be either a server property or an ident, which is what that assertion failure is trying to tell you

lgessler15:06:55

you gave it a seq of idents which isn't supported--probably you want a single call to df/load! per ident, or a call to load! on a parent component

❤️ 1
cl_j15:06:20

What i want is to use the batch query as described https://blog.wsscode.com/pathom/#_n1_queries_and_batch_resolvers

cl_j15:06:53

maybe i should just pass the list of keys in :param to df/load!

lgessler15:06:57

I think the "right" way to do that is just to call load! on a parent component--then pathom will see the EQL query 's list of child idents and use your batch resolver

👍 1
lgessler15:06:10

though if that's not possible for some reason, yeah, you may need to engage in hackery

cl_j15:06:04

I'll try using parent component, thanks!