How to return a custom list with extra key-value pair(s)?
I am trying to return list from my table "riskAssessments" but with an extra key-value pair on each element to add in the value of a subquery : I know that the subquery works because I use it in my
getById
query which returns a single entry. The basic list
query I've defined also returns the correct result. Because there's no way (seemingly?) to step through the .ts file code on my browser dev-tools, I have no idea where it is going wrong, but it is simply returning an empty array instead of what I want. I'm sorry if this is the wrong place to put this question - this is the only place I've been able to find. Thanks for reading! EDIT : I had to add the --typecheck=disable
flag to get convex to run, as I'm using TS.2 Replies
It looks like the
listWithVendorNames
handler might be returning assessmentsWithVendorNames
before any of the async functions execute
You can rewrite the forEach
as
which will wait for all the subqueries to finish executing
You can also write it as a for
loop (which I slightly prefer since it's more legible):
@alixi thanks so much, I was going crazy trying to figure out what was up.