Skip to content

fix(spinner):Fixed spinner animation interruption bug. #56

Merged
LittleLittleCloud merged 9 commits intoRazorConsole:mainfrom
TeseySTD:main
Oct 24, 2025
Merged

fix(spinner):Fixed spinner animation interruption bug. #56
LittleLittleCloud merged 9 commits intoRazorConsole:mainfrom
TeseySTD:main

Conversation

@TeseySTD
Copy link
Member

Problem

When the UI is interacted with (e.g. button click or navigation menu toggle), spinner instances get recreated and their animation restarts from the beginning. This produces a visible jump in the spinner every time the DOM is re-rendered.

Root cause

Each AnimatedSpinnerRenderable started its own Stopwatch in the constructor, so a newly created instance always displayed frame 0. Re-creating the renderable on every interaction therefore resets the spinner.

Solution

Compute the current frame from a global clock instead of using a per-instance Stopwatch. The spinner frame index is now derived from DateTime.UtcNow (scaled by spinner interval), so new instances continue the animation position instead of starting over.

TeseySTD and others added 8 commits October 23, 2025 16:10
Corrected spelling of 'styleAttribution' to 'styleAttribute' and 'justifyAttribution' to 'justifyAttribute' for consistency with standard naming conventions.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
Set lowercase letters for field names

Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a visual bug where spinner animations restart from frame 0 whenever the UI is re-rendered (e.g., during button clicks or menu toggles). The solution replaces per-instance Stopwatch timing with a global clock based on DateTime.UtcNow, ensuring that newly created spinner instances continue the animation from the current frame rather than resetting.

Key Changes:

  • Removed the per-instance Stopwatch field from AnimatedSpinnerRenderable
  • Switched to DateTime.UtcNow.Ticks as the timing source for calculating the current spinner frame
  • Added safeguard logic to prevent division by zero when _interval.Ticks is invalid

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Skoreyko Misha <150385054+TeseySTD@users.noreply.github.com>
Copy link
Member

@LittleLittleCloud LittleLittleCloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@LittleLittleCloud LittleLittleCloud enabled auto-merge (squash) October 24, 2025 13:11
@LittleLittleCloud LittleLittleCloud merged commit 314457e into RazorConsole:main Oct 24, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants