Looping a GraphQL mutation query

4 0 1

Hey all, so I'm working on a custom app that shows a list of the orders in my test store and can be filtered. I followed the Shopify App tutorial to load the data using a <Query> element from 'react-apollo'.

Now, I'm having a bit of trouble implementing my next requirement: Given the list of filtered items shown on the table, I need to be able to add a tag to each of them. But I'm not sure how to implement this in the same page, since the tutorial has you redirect to a separate page and edit a single item at a time.

I have already declared a mutation for tagsAdd, and I have verified that it works on the GraphiQL explorer. I am also saving the list of orders from the query to my state, so I can loop through each ID as needed. But the problem is: how do I call the mutation on each iteration of the loop to add a tag to each id? I don't think using a <Mutation> tag here is the way to go, and I'm not sure how to proceed from here.

Any help will be greatly appreciated, thanks!