Trigering queries in parallel make them overwrite each other

EDIT: Because the stupid limitation of not being able to post more than one image I had to break the post into 3 posts
I am performing a very basic JS task and I am facing what I think it is a bug on the platform. I have a code that triggers a query several times with different parameters. The queries are supposed to run in parallel, but if I do that then all the queries are triggered with the same parameters. It looks like triggering them too close to each other makes the new trigger to overwrite the parameters of the previous query and they are all executed with the same parameters.

This is the code:

const data = await GetAccountPayments.trigger({additionalScope: { page: 0 }})
if(data.totalPages <= 1) return data.content
const queries = _.range(1,data.totalPages).map(
	    (idx) => GetAccountPayments.trigger({additionalScope: { page: idx }}).then(data => ({data, idx}))

return Promise.all(queries).then(result => {
  return [data, ...result]

As you can see, first I trigger the query and wait for it, that works perfectly, then inside the loop when I trigger them all in parallel they all get the same parameters, that's why I know the bug is they overwrite each other, because if you do them sequentially it just works.
This is the first query with the correct first parameter (the 0) on the queryParams[2]

However, all the next queries (in this case another 2) they all are executed with the same query params a 2:

Also I'm 100% confident that the bug is on the platform because the console is correctly reporting that the correct extra parameters are being provided:


Having to fire all the queries in series it is a huge performance hit compared to running them all in parallel.

Just modified my code a bit to run all the queries in series and it works correctly:

const data = await GetAccountPayments.trigger({additionalScope: { page: 0 }})

const queries = _.range(1, data.totalPages).reduce((prev, idx) =>
                          (val) => GetAccountPayments.trigger({additionalScope: { page: idx }})
                                                                            .then(newData => val.concat(newData))
  , Promise.resolve([data])

return queries.then(result => {
  return result

THIS IS NOT A SOLUTION TO MY PROBLEM it is just a demonstration of why the problem happens, this is only a workaround

Hey Danielo,

I tried reproducing this on my end using just a simple rest query to postman-echo, and both the serial and parallel versions worked fine. Are you able to share a screenshot of your GetAccountPayments query? It seems possible that there is something odd with that query which could be resulting in the behavior you are seeing.

Hello @mark
This is the query on the query library:

And this is how it looks like on the app:

Hmm, nothing stands out as particularly strange with those queries to me. Would you be able to share an export the app so that I can investigate a bit more? You can upload it here:

(@Danielo just updated the settings to allow more images, sorry about that)

I asked support on the app to review this thread and I granted them permissions to inspect my account. Is that enough?

Hey Danielo, looks like another support team member was asking some questions in that ticket you started. Feel free to respond there, or open another ticket. We should be able to help you out there!