Fork me on GitHub

what’s the best way to handle returning idents to fulcro out of my pathom resolvers? adding a [:thing/by-id thing-id to a return value throws an error, ostensibly because pathom is further trying to parse that ident? would appreciate any direction or input


obviously if thing is a deeply nested structure, I don’t want to have to pull all of that and re-parse it in my resolver and let fulcro normalize it on the client. would prefer to just spit back an ident that can be incorporated into my fulcro db as is


my precise issue is trying to return something from my thing resolver that looks like {:thing/property-a 123 :thing/creator [:users/by-id #uuid ....]}


@mss I don't get it yet, can you please show some example query and data of what's happening?


sure, hope this makes sense: so I have a query generated from a few query components that looks roughly like the following:

{:project/test-runs [:test-run/id
                     {:test-run/test 1}
                     {:test-run/initiator 1}]}
the :test-run/test and :test-run/initiator are set to 1 bc as I understand it, this prevents circular references to things that reside elsewhere in my db and are served by other queries the result spit back from my resolver is something like:
 [{:test-run/id #uuid "537d4901-7bcc-4201-b5e8-71670d0b4309",
   :test-run/progress 0,
   :test-run/status :test-run-statuses/not-started,
   :test-run/test [:tests/by-id #uuid "5b16d210-f826-4823-9573-83240c8e41fa"],
   :test-run/initiator [:users/by-id #uuid "c926d210-f826-4823-9573-83240c8e28s2"]}]}
receiving a reader error within pathom, ostensibly for those two properties that java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long


clearly I’ve misunderstood something about circular refs in queries and how those would translate to pathom


I think the problem is that {:test-run/test 1} and {:test-run/initiator 1} is not valid syntax in EQL. I'm not sure about the circular references thing you are refering to, but maps are used to represent joins (and unions) so pathom is probably expecting 1 to be a vector of attributes to read from the test and initiator and that is what is causing the error


the query is valid, its a recursion with limit, the problem is with your returns, the values should be maps instead of idents, try making your data looks like this:

 [{:test-run/id #uuid "537d4901-7bcc-4201-b5e8-71670d0b4309",
   :test-run/progress 0,
   :test-run/status :test-run-statuses/not-started,
   :test-run/test {:tests/id #uuid "5b16d210-f826-4823-9573-83240c8e41fa"}
   :test-run/initiator {:users/id #uuid "c926d210-f826-4823-9573-83240c8e28s2"}}]}

👍 4

makes sense. so that works as far as satisfying pathom, unfortunately it looks like my mental model of how to avoid circular refs in fulcro queries is a little busted. going to pop on over to that channel and dig in


thanks for the help y’all


imagine that for every join you are changing the context, when we do use idents like [:person/id 123], what we are effectively doing is start a context with {:person/id 123}, so when you return maps to get further processed, they are the initial context for the join and pathom will use the resolver data to figure it out, makes sense?

👍 4