Skip to content

Commit

Permalink
fix: move back to OnAfterFirstRender
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Apr 11, 2024
1 parent 9ebb782 commit 8580ad1
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ else
}

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

Expand All @@ -99,18 +98,16 @@ else
isLoading = true;
BlogPost = await BlogPostRepository.GetByIdAsync(BlogPostId);
isLoading = false;

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

lastBlogPostId = BlogPostId;
}

protected override async Task OnAfterRenderAsync(bool firstRender)
{
await JsRuntime.InvokeVoidAsync("hljs.highlightAll");

if (firstRender)
{
_ = UserRecordService.StoreUserRecordAsync();
}
}

private async Task UpdateLikes(bool hasLiked)
Expand Down

0 comments on commit 8580ad1

Please sign in to comment.