fix: re-init scroll animations after data loads from DB
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m55s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m55s
- initScrollAnimations ran only on firstRender when data wasn't loaded yet - Items with fade-in-up class stayed invisible (opacity:0) after data render - Now tracks _dataLoaded/_animationsInitialized flags to re-init JS after data loads - Also fixes stat counter animations not running (stats were empty on firstRender)
This commit is contained in:
@@ -26,6 +26,10 @@ public partial class Index : IDisposable
|
||||
private List<TestimonialItem> _testimonials = new();
|
||||
private List<QA> _faqs = new();
|
||||
|
||||
// Track whether animations need re-initialization after data load
|
||||
private bool _dataLoaded;
|
||||
private bool _animationsInitialized;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MainService.OnChangeHandler += OnStateChanged;
|
||||
@@ -45,6 +49,7 @@ public partial class Index : IDisposable
|
||||
}
|
||||
|
||||
PopulateFromSettings();
|
||||
_dataLoaded = true;
|
||||
|
||||
// Load latest published blog posts
|
||||
try
|
||||
@@ -222,8 +227,11 @@ public partial class Index : IDisposable
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
// Init/re-init scroll animations after data is loaded and rendered
|
||||
if ((firstRender || (_dataLoaded && !_animationsInitialized)) && _steps.Any())
|
||||
{
|
||||
_animationsInitialized = true;
|
||||
|
||||
// Init scroll-triggered fade-in animations
|
||||
await JS.InvokeVoidAsync("initScrollAnimations");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user