Skip to content

Fix FinOps Database Sizes empty until manual refresh (init-order race)#1179

Merged
erikdarlingdata merged 1 commit into
devfrom
feature/finops-dbsizes-initorder
Jun 20, 2026
Merged

Fix FinOps Database Sizes empty until manual refresh (init-order race)#1179
erikdarlingdata merged 1 commit into
devfrom
feature/finops-dbsizes-initorder

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

Summary

The FinOps Database Sizes tab showed no data on first load (every other FinOps tab populated); a manual refresh fixed it. Root cause is an init-order race:

Initialize() sets ServerSelector.SelectedIndex = 0SelectionChangedRefreshDataAsyncLoadDatabaseSizesAsync. That loader fetches the rows then bails at if (_dbSizesFilterMgr == null) return;. But _dbSizesFilterMgr was created in OnLoaded, which can fire after Initialize() — so on first load the data was fetched and silently discarded. A later manual refresh ran after OnLoaded, so it worked. It's the only FinOps sub-tab whose DataGridFilterManager was created in OnLoaded, which is why only it was affected.

Fix: create _dbSizesFilterMgr in the constructor (the grid exists right after InitializeComponent), so it's always ready before any load — removing the race. One-line move.

Pre-existing race; unrelated to the recent FinOpsContent partial-class split (that only relocated LoadDatabaseSizesAsync).

Test plan

  • dotnet build PerformanceMonitor.sln — succeeds
  • Dashboard.Tests491 passed
  • Manual: open FinOps → Database Sizes on a fresh launch → data present without a manual refresh

🤖 Generated with Claude Code

LoadDatabaseSizesAsync fetches the data then bails at `if (_dbSizesFilterMgr ==
null) return;`. _dbSizesFilterMgr was created in OnLoaded, but Initialize() sets
ServerSelector.SelectedIndex = 0, which fires ServerSelector_SelectionChanged ->
RefreshDataAsync -> LoadDatabaseSizesAsync — and that can run before the Loaded
event. When it did, the loader fetched the rows and discarded them, leaving the
Database Sizes tab empty until a manual refresh (by which time OnLoaded had run).

Create _dbSizesFilterMgr in the constructor instead (the grid exists right after
InitializeComponent), so it's always ready before the first load. It's the only
FinOps sub-tab whose DataGridFilterManager was created in OnLoaded, which is why
it alone was affected.

Pre-existing race (unrelated to the FinOpsContent partial-class split). Solution
builds clean; Dashboard.Tests (491) pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit 258bd91 into dev Jun 20, 2026
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