I’m trying to use queries within JSObjects in this fashion:
func: async () =>
{
await query.run();
// Have to do this, otherwise, next line will fail intermittently.
await new Promise(r => setTimeout(r, 500));
var res = query.data["result"];
console.log(res);
}
I thought based on the docs that awaiting query.run() should wait until query settles and data is available in query.data property. However, it seems it is not the case and I have to add delays to make sure accessing query.data doesn’t fail.
Am I missing something?