Fork me on GitHub
#graphql
<
2022-08-01
>
Daniel Craig16:08:00

Hi all, I'm attempting to load about 30 rows of table data as individual re-graph queries and I am seeing that my queries don't complete and I can see in reframe-10x that a regraph.internals/register-abort event is being handled - are my queries being aborted? what can I do about this?

oliy18:08:51

No, that is just an implementation detail for supporting the abort feature, it doesn't mean it's been run

oliy18:08:23

Are you using websockets or http? Are all the requests being made / returning success?

Daniel Craig19:08:24

I'm using http, and it looks like only one of my requests is actually being made, thanks for the tip to check the requests.

Daniel Craig19:08:47

This is what I have in the effect handler that's supposed to be dispatching one query per date:

(re-frame/reg-event-fx
 :table/set-counts-for-dates
 [(re-frame/inject-cofx ::inject/sub [:table/dates])]
 (fn [{db :db dates :table/dates} event]
   (let [fx-list (mapv (fn [date]
                         [:dispatch [::re-graph/query
                                     :query-counts-for-date
                                     "($date: ID!){countsForDate (date: $date) {aircraftPatternCount flightCount}}"
                                     {:date date}
                                     [:table/set-counts-for-single-date]]]) dates)]
     {:fx fx-list})))

Daniel Craig19:08:35

But it's only dispatching the first ::re-graph/query event

oliy19:08:53

Ah, you are setting the query id as :query-counts-for-date on each one. Re-graph is deduping them for you

oliy19:08:28

Make the id unique (or omit it altogether, if you don't refer to it elsewhere)

Daniel Craig19:08:16

That did it! Thanks! I love your library