Skip to content

Commit

Permalink
Only record once
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Apr 11, 2024
1 parent 86fd9a8 commit 9ebb782
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ else
}

@code {
private string lastBlogPostId = null;
[Parameter]
public string BlogPostId { get; set; }

Expand All @@ -96,9 +97,15 @@ else
protected override async Task OnParametersSetAsync()
{
isLoading = true;
BlogPost = await BlogPostRepository.GetByIdAsync(BlogPostId);
isLoading = false;
_ = UserRecordService.StoreUserRecordAsync();
BlogPost = await BlogPostRepository.GetByIdAsync(BlogPostId);
isLoading = false;

if (lastBlogPostId != BlogPostId)
{
_ = UserRecordService.StoreUserRecordAsync();
}

lastBlogPostId = BlogPostId;
}

protected override async Task OnAfterRenderAsync(bool firstRender)
Expand Down

0 comments on commit 9ebb782

Please sign in to comment.