Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor - should I read in my data in OnInitializedAsync() or OnAfterRenderAsync(true)

$
0
0

When my page loads, generally I am hitting the database to get the data for that page. It's not a ton of data so not the end of the world if I read it twice, but better to read it once.

The page can render without this data, but it's going to look very empty/sparse if it's viewed without the data. Not wrong, no errors, but empty.

So, when is the suggested place to load the data for the page? And if it's OnInitializedAsync(), should I have a boolean so I load the first time and subsequent times I know I already have it?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>