core
core copied to clipboard
fix (server-renderer): stability - stop server crashing with unhandled promise rejection
If an async component throws a template rendering error whilst another async component is being rendered it results in a unhandled promise rejection and the server crashing. This is because the async components are processed in a synchronous loop (via unrollBuffer) creating this race condition.
Much like if there are prefetches, we must explicitly add error handling to the promise. We are still returning the original promise so that the error handling hooks can still process the error correctly.