Seeking assistance with a behavior that I am uncertain about. The issue I am facing is that the clients.forEach() function is throwing an error in my code snippet below. I suspect this is happening because it runs simultaneously with the forkJoin(). As a result, the clients array is empty when clients.forEach() tries to execute. Is there a way to make the subsequent code block "pause" until the forkJoin() function finishes executing without having to nest clients.forEach() inside the subscription() function? Furthermore, the clients.forEach() implementation is lengthy and convoluted.
forkJoin({
xclients: this.clients$,
xkycMetrics: this.clientsBySHID$
}).subscribe(({xclients, xkycMetrics}) => {
clients = xclients,
kycMetrics = xkycMetrics
});
// Client Data
clients.forEach(client => {......});