Skip to content

Move progress bar animation init to Loaded event to fix possible null exception of ProgressBar#4313

Open
Jack251970 wants to merge 1 commit intodevfrom
InitProgressbarAnimation_Null
Open

Move progress bar animation init to Loaded event to fix possible null exception of ProgressBar#4313
Jack251970 wants to merge 1 commit intodevfrom
InitProgressbarAnimation_Null

Conversation

@Jack251970
Copy link
Member

@Jack251970 Jack251970 commented Mar 2, 2026

InitProgressbarAnimation is now triggered by the progress bar's Loaded event instead of during main window initialization. This ensures the animation starts only after the progress bar is fully loaded, improving reliability and preventing potential UI timing issues.

Resolve #4311


Summary by cubic

Moves the progress bar animation init from window load to the ProgressBar Loaded event. This prevents null reference exceptions and ensures the animation starts only after the control is ready.

  • Summary of changes
    • Changed: Removed InitProgressbarAnimation() call from MainWindow.OnLoaded; animation now depends on the ProgressBar’s lifecycle.
    • Added: ProgressBar_Loaded event handler in code-behind that calls InitProgressbarAnimation(); wired up in XAML via Loaded="ProgressBar_Loaded".
    • Removed: Early initialization of the progress bar animation during main window initialization.
    • Tests: No unit tests added (UI timing change).
    • Security: No security impact; UI-only change.

Written for commit a2f2242. Summary will update on new commits.

InitProgressbarAnimation is now triggered by the progress bar's Loaded event instead of during main window initialization. This ensures the animation starts only after the progress bar is fully loaded, improving reliability and preventing potential UI timing issues.
Copilot AI review requested due to automatic review settings March 2, 2026 10:21
@prlabeler prlabeler bot added the bug Something isn't working label Mar 2, 2026
@github-actions github-actions bot added this to the 2.2.0 milestone Mar 2, 2026
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

Moves progress bar animation initialization to the ProgressBar Loaded event to avoid timing-related null access during main window initialization.

Changes:

  • Removed InitProgressbarAnimation() call from MainWindow.OnLoaded.
  • Added a ProgressBar_Loaded handler in code-behind to trigger InitProgressbarAnimation().
  • Wired the ProgressBar Loaded event in XAML.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Flow.Launcher/MainWindow.xaml.cs Removes initialization from window load and introduces ProgressBar_Loaded to init animation when the control is loaded.
Flow.Launcher/MainWindow.xaml Hooks the ProgressBar Loaded event to call the new handler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 2, 2026

📝 Walkthrough

Walkthrough

Moves progress bar animation initialization from the main window's Loaded event to the progress bar's own Loaded event handler, ensuring the control is fully initialized before animation setup begins.

Changes

Cohort / File(s) Summary
ProgressBar Event Binding
Flow.Launcher/MainWindow.xaml
Added Loaded event binding to ProgressBar element, wiring it to ProgressBar_Loaded handler for initialization.
ProgressBar Initialization Handler
Flow.Launcher/MainWindow.xaml.cs
Added ProgressBar_Loaded event handler to invoke InitProgressbarAnimation and removed the same call from OnLoaded method, changing initialization sequence.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • jjw24
  • onesounds
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: moving progress bar animation initialization to its Loaded event to fix a null exception.
Linked Issues check ✅ Passed The changes directly address issue #4311 by moving InitProgressbarAnimation from main window initialization to the ProgressBar's Loaded event, preventing null reference exceptions.
Out of Scope Changes check ✅ Passed All changes are focused on resolving the progress bar initialization timing issue described in issue #4311; no extraneous modifications are present.
Description check ✅ Passed The description clearly relates to the changeset by explaining why progress bar animation initialization is being moved to the Loaded event to fix timing and null reference issues.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch InitProgressbarAnimation_Null

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@gitstream-cm
Copy link

gitstream-cm bot commented Mar 2, 2026

🥷 Code experts: jjw24

jjw24, Jack251970 have most 👩‍💻 activity in the files.
Jack251970, jjw24 have most 🧠 knowledge in the files.

See details

Flow.Launcher/MainWindow.xaml

Activity based on git-commit:

jjw24 Jack251970
MAR
FEB
JAN
DEC 1 additions & 1 deletions
NOV
OCT 1 additions & 1 deletions

Knowledge based on git-blame:
jjw24: 100%

Flow.Launcher/MainWindow.xaml.cs

Activity based on git-commit:

jjw24 Jack251970
MAR
FEB
JAN
DEC
NOV 1 additions & 1 deletions
OCT 8 additions & 7 deletions

Knowledge based on git-blame:
Jack251970: 100%

✨ Comment /gs review for LinearB AI review. Learn how to automate it here.

@gitstream-cm
Copy link

gitstream-cm bot commented Mar 2, 2026

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

@Flow-Launcher Flow-Launcher deleted a comment from gitstream-cm bot Mar 2, 2026
@jjw24
Copy link
Member

jjw24 commented Mar 3, 2026

Do we know if this actually solves the issue?

@Jack251970
Copy link
Member Author

Jack251970 commented Mar 3, 2026

Do we know if this actually solves the issue?

It is very hard to reproduce this issue since this issue happens only if the ProgressBar is not loaded when window is loaded (You need a computer with high computation speed and good gpu performance). We can only analyze the root reason of the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: InitProgressbarAnimation NullException

3 participants