Fix FinOps Database Sizes empty until manual refresh (init-order race)#1179
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()setsServerSelector.SelectedIndex = 0→SelectionChanged→RefreshDataAsync→LoadDatabaseSizesAsync. That loader fetches the rows then bails atif (_dbSizesFilterMgr == null) return;. But_dbSizesFilterMgrwas created inOnLoaded, which can fire afterInitialize()— so on first load the data was fetched and silently discarded. A later manual refresh ran afterOnLoaded, so it worked. It's the only FinOps sub-tab whoseDataGridFilterManagerwas created inOnLoaded, which is why only it was affected.Fix: create
_dbSizesFilterMgrin the constructor (the grid exists right afterInitializeComponent), 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— succeedsDashboard.Tests— 491 passed🤖 Generated with Claude Code