Fork me on GitHub

Not sure if this is a Fulcro or a Pathom question: I have a set of Pathom resolvers I’ve written to wrap the Trello APIs — consider this component that displays 1) the names of all the lists, along with 2) the number of cards in that list in parentheses. Query #1 is fast, but Query #2 is slow (even with batching, which parallelizes all the calls that retrieves all the cards in the list and counts them). I was happy how easy it was to write the resolver for Query #2, but the render waits until all of the data is retrieved. Which is what I expected, and is great. But is there an easy and recommended and idiomatic way of displaying just the list names (which would be instantaneous), and then displaying all the list counts when they’re all available? Thanks! (In my old implementation in re-frame, I just displayed the list names, and asynchronously assoced the list counts as they came in. Obviously, that method doesn’t work in Fulco, where the bindings to data are more explicit.).


Holy cow. That’s… incredible…. Thank you, @U016TR1B18E (and @U0CKQ19AQ!)

🎉 2

Oops. I think this gets me almost there. I can prune the load!, but then how would I modify the component so that it skips rendering the list count, until it arrives later?

Tyler Nisonoff17:07:49

you could check the props and see if you have that key / value, and not render it if you dont have a count?


Nice! I’ll give it a try! Thanks again!

👍 2

It worked — thank you! For others facing the problem, I changed the :on-select even to the following:

                        (fn [board-id]
                          ; ; ident: [:story/id story-id]
                          ; it's what triggers the resolver, it's how you access
                          ; local client database
                          (println "TrelloMain: on-select: triggered: " board-id)
                          ; load once without list-card-counts, and then once more with
                          ; to speed up first frame render
                          (df/load! this [:trello-board/id board-id] SelectedBoard
                            {:target [:component/id ::TrelloMain :ui/selected-board]
                             :without #{:trello-list/count-cards}})
                          (df/load! this [:trello-board/id board-id] SelectedBoard
                            {:target [:component/id ::TrelloMain :ui/selected-board]}))