Fork me on GitHub
#pathom
<
2021-07-27
>
wilkerlucio14:07:40

@U0CL38MU1 includes the fix for that batch cache case

cyppan14:07:18

💯 thanks

markaddleman15:07:26

Congrats on the release! I don't think ::pco/transform is documented in the Pathom 3 docs. At least, I couldn't find it with a simple search

wilkerlucio15:07:00

well noted, it really isn't, adding to the todolist 🙂

markaddleman15:07:16

No rest... 🙂 Thanks!

markaddleman18:07:40

Oh! This is awesome and I think I have a use case for it in my current project

wilkerlucio20:07:24

the example was wrong, publishing a fix now

genekim16:07:53

I’m trying to puzzle out why an “N+1” query is happening, despite writing a batch resolver (holy cow, I just saw how batch-transforms now makes it easier to write batch code. Nice!!! I can’t wait to get rid of all those (if (sequential? input)) from code! 🙂 I have the following resolvers to 1) fetch list of all Trello boards, and 2) fetch all the lists associated with each board.

(pc/defresolver trello-boards [env input]
  {;::pc/input  #{:trello/board-id}
   ::pc/output [{:trello/boards
                 [:trello-board/id :trello-board/name :trello-board/starred
                  :trello-board/lists]}]})

(pc/defresolver trello-board-lists [env input]
  {::pc/input  #{:trello-board/id}
   ::pc/output [:trello-board/id
                {:trello-board/lists
                 [:trello-list/id :trello-list/name :trello-list/board-id
                  :trello-list/pos]}]}
  ::pc/batch? true})
When I execute this query, the trello-board-lists resolver is only called with maps, never sequentials, so the lists are always fetched sequentially, not in parallel. Does anyone have any advice on how I can make sure that resolver is called in a way that always triggers batching? Thank you!
[{:trello/boards
      [:trello-board/id :trello-board/name :trello-board/lists]}]

genekim16:07:51

Ah, I meant to say more explicitly “thank you, @U066U8JQJ” for the batch-transform feature. Lovely!

wilkerlucio16:07:42

thanks @U6VPZS1EK 🙂. this was also simplified in Pathom 3, there batch resolvers always get a sequence (never a single entry)

wilkerlucio16:07:10

not sure if I understand your case in full, but in Pathom 2 there is a limitation in batch, it only works when the items are an immediate sequence, (like, the item directly under some collection)

wilkerlucio16:07:24

if there is a more than 1 level separating the list from the batch attribute, it doesn't work

wilkerlucio16:07:51

this was also fixed in Pathom 3, where it doesn't care at all about this kind of structure, and can batch across any different points of the query

genekim16:07:52

Thank you! A wonderfully simple explanation! (I’ll rewrite the query. But now I’m curious about what @U0CKQ19AQ’s plans are on whether / when Pathom 3 migration may happen.) Onwards! 🙂

wilkerlucio16:07:56

for Fulcro users it should be a simple change in terms of swiping one from the other, for Fulcro all that matters is a EQL engine to fulfill the requests. the work will be migrating the current implementation on the server to use Pathom 3 things, but on the client the changes should be trivial

wilkerlucio16:07:12

(I already have a couple of toy projects using Fulcro and Pathom 3 that I do for experimentation)