A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
Hi,
With later versions of Episerver/Optimizely, we've been given a abstraction called AsyncBlockComponent. According to the documentation, the purpose is "Provides the base implementation for asynchronus block components". I think that it's existence leads the developer into thinking this is a way to write true async code. Async child actions (= blocks) was maybe not allowed in .NET Framework, but this is no longer the case in .NET Core... I think, at least.
But! On the other hand, true async code must use async all the way or task return types, but using Html.PropertyFor(...) to render a content area is neither of them.
Digging deeper, I can see that rendering a content area is done via the method below (see bottom of post). Execution of block components are wrapped in a GetAwaiter().GetResult() context, which is NOT async code. Rather, this leads to deadlocks and downtime.
In our scenario, we have a product recommendations blocks that render user-unique recommendations fetched from a REST API.
I guess I have three questions - is my understanding correct, was everyone aware of this, and, how do you solve the problem?
Even though your block component can run async code internally, the CMS rendering pipeline still blocks on the result.