fulcro

Thomas Moerman 2026-04-29T18:47:58.734739Z

Small Q: is it possible to pass an :update-query to a mutation join returning component?

Thomas Moerman 2026-04-30T10:01:08.870449Z

Apologies for being a bit too vague there. It was indeed about morphing the query for the mutation join, adding extra parameters in keys a bit deeper into the query tree, analogous to what df/load! allows with the :update-query option. A variation on the m/returning fn would indeed be a good option, I'll have a try at that.

tony.kay 2026-04-30T12:33:25.761039Z

I’m not opposed to adding the update-query parameter to the options of m/returning.

tony.kay 2026-04-30T12:34:07.953989Z

But my guess is your specific use-case might be better served by something more project specific anyway.

tony.kay 2026-04-29T20:14:23.337899Z

I don’t understand your question. Are you asking if you can cause a mutation join to emit the “current dynamic query” from a live component that has a dynamically modified query? The (m/returning) primitive does exactly that.

tony.kay 2026-04-29T20:15:02.172669Z

or do you mean you want to morph the outgoing query in an arbitrary way?

tony.kay 2026-04-29T20:15:45.957199Z

This is the definition of returning:

(defn returning
  "Indicate the the remote operation will return a value of the given component type.

  `env` - The env of the mutation
  `class` - A component class that represents the return type.  You may supply a fully-qualified symbol instead of the
  actual class, and this method will look up the class for you (useful to avoid circular references).
  `opts` (optional):
   - `query-params` - Optional parameters to add to the generated query

  Returns an update `env`, and is a valid return value from mutation remote sections."
  ([env class]
   (returning env class nil))
  ([env class {:keys [query-params]
               :as   opts}]
   (let [class (rc/registry-key->class class)]
     (let [{:keys [state ast]} env
           {:keys [key params query]} ast
           component-query (rc/get-query class @state)
           updated-query   (cond-> (eql/query->ast component-query)
                             query-params (update-in [:children 0] assoc :params query-params)
                             :then (eql/ast->query)
                             query (vary-meta #(merge (meta query) %)))]
       (assoc env :ast (eql/query->ast1 [{(list key params) updated-query}]))))))
Roll your own. The helper is just mucking with the AST of the EQL…so yes, you can do what you want.