Closed dartuso closed 6 months ago
You're instantiating a new Api
object which has the AsyncLazy<DTO>
as an instance field. Either the Api
instance needs to be shared, or the AsyncLazy<DTO>
instance needs to be shared if you don't want it to run more than once.
Awesome thank you! That was my suspicion.
I am using AsyncLazy in a shared class between multiple blazor components, which all want the data OnInitializedAsync
As show in this blog I am replicating the structure of data caching
https://blog.stephencleary.com/2013/01/async-oop-3-properties.html In API class
I am in each component (4 rendering at same time) calling via
However, I see the API called twice across the 4 components