I am working on a project that includes a list of Help Articles.
Clicking on an Article in the list opens the Article.
OnInitializedAsync() calls to the API for the Article.include(Comments).theninclude(Replies).
I have a CommentList component that builds the comment list using instances of Comment component
Each Comment has a ReplyList component that builds a reply list using instances of Reply component
The page is built:
- Article API Call including Comments then Replies
- CommentList
[Parameter] public <ArticleDto> Article - Comment instances
[Parameter] public <CommentDto> Comment - ReplyList
[Parameter] public <ReplyDto> Reply - Reply instances
[Parameter] public <ReplyDto> Reply
The page is slow to render with a lot of foreach and if checks so I'm left wondering if my approach is a bit immature?
If you've faced this dilemma, I'd love to hear what your approach was.
I'm considering having each list component make its own API call but I was hoping to avoid multiple calls to build a single page. Virtualization seems like a good candidate perhaps?