Skip to content

Fix legend duplication on tab switch#841

Merged
erikdarlingdata merged 1 commit intodevfrom
fix/dashboard-unloaded-cleanup
Apr 15, 2026
Merged

Fix legend duplication on tab switch#841
erikdarlingdata merged 1 commit intodevfrom
fix/dashboard-unloaded-cleanup

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Summary

Move teardown logic from ServerTab_Unloaded to a new CleanupOnClose method. WPF fires Unloaded on tab switch (not just destruction), which was clearing _legendPanels, disposing chart helpers, and unsubscribing events while the auto-refresh loop was still running. This caused duplicate legends on every tab switch.

Now Unloaded is a no-op. CleanupOnClose is called from MainWindow only when a tab is actually closed/removed.

Test plan

  • Switch between sql2022 and sql2019 tabs — legends remain single instance
  • Manual refresh on each tab after switching — no duplicates
  • Auto-refresh keeps ticking through tab switches

🤖 Generated with Claude Code

…leanupOnClose

WPF fires Unloaded on tab switch, not just destruction. The old handler
tore down legend tracking, chart helpers, and event subscriptions on
every tab switch, causing the auto-refresh loop to lose track of legend
panels and create duplicates. Now Unloaded is a no-op; full cleanup
only runs via CleanupOnClose when a tab is actually closed/removed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit 980e9bd into dev Apr 15, 2026
@erikdarlingdata erikdarlingdata mentioned this pull request Apr 15, 2026
12 tasks
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.

1 participant