Fork me on GitHub
#pathom
<
2021-07-08
>
lgessler21:07:43

hi, I'm having an embarrassingly simple issue with pathom 2: it's my first time implementing a to-many join in my resolvers, and I'm getting an error Don't know how to create ISeq from: clojure.lang.Keyword when pathom attempts to follow the to-many join. I have a declared pc output :foo/to-many-join, and my output looks like {:foo/id ... :foo/to-many-join [[:bar/id 1] [:bar/id 2]]. Is there something wrong with the shape of my data for :foo/to-many-join?

lgessler21:07:12

I do have ::pc/open-ident-reader in my parser's ::p/reader , which I think is necessary for the ident-style joins

wilkerlucio22:07:47

hello, yes, the output shape is wrong, a to-many must have a collection of maps, not idents

wilkerlucio22:07:03

this is in contrast with Fulcro, in Fulcro normalized DB it uses the idents to ref things, but that's not how Pathom works

wilkerlucio22:07:25

in your case you need to return something like: {:foo/id ... :foo/to-many-join [{:bar/id 1} {:bar/id 2}]

👍 3
wilkerlucio22:07:46

so you have the initial data for pathom to extend on top

lgessler22:07:06

got it, thank you!

lgessler22:07:16

follow-up question... before I checked back here for your messages I just finished refactoring my code to use p/parallel-parser with pc/parallel-reader and pc/mutate-async and the fulcro-style ident seems to work?

lgessler22:07:30

I'm guessing this is unofficial behavior which may break in the future, right?

lgessler22:07:24

anyway... i'll just use hashmaps now

wilkerlucio23:07:36

be careful with parallel parser though, there only a few cases in which its a good option for general users

wilkerlucio23:07:03

most of the time is slower and way more complex, not worth until you can really leverage a lot parallelism (measure your cases if you wanna check)

wilkerlucio23:07:11

but in general, better to stick with the serial one

👍 3
lgessler03:07:48

thanks, didn't realize that. back to reader2 for now then