0👍
✅
My suggestions would be to move this complex logic into a client-side worker script that makes the requests and any filtering. Second as a UI/UX level would be to add a “Working…” overlay with some form of animation that indicates that work is being done.
As to doing this work server-side… If you do server-side rendering via Node, that does complex blocking calculations that will inhibit ALL users unless you inject some form of worker pool or RPC fronting worker queue. It’s possible but the answers and options are more complex and beyond scope for this site.
As mentioned above, a worker with some animation is probably the best way to go here.
Source:stackexchange.com