We have a javascript query that triggers a bunch of other queries in succession and using the .onSuccess()
callback leads to some pretty gnarly spaghetti code. I saw the documentation on query.trigger()
and promises and tried to use .then()
to link my queries:
updateLocation.trigger(queryScope).then(createDistribution.trigger({additionalScope:{...queryScope.additionalScope,distributionTypeId:distributionTypeId()}}))
but that doesn’t seem to do what I want–both queries are still getting called.
Am I doing something wrong?