Skip to content

Rebuild groups without rendering an empty table in between - #474

Open
AsafMah wants to merge 1 commit into
w-ahmad:mainfrom
AsafMah:fix/grouping-flicker
Open

AsafMah wants to merge 1 commit into
w-ahmad:mainfrom
AsafMah:fix/grouping-flicker

Conversation

@AsafMah

@AsafMah AsafMah commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Description

When the grouping changes, OnCollectionViewPropertyChanged detaches ItemsSource, awaits Task.Yield(), then reattaches it. The yield lets a frame render with no items, so on every grouping change (Group, Ungroup, adding a nested level) the table flickers empty for a moment before the new groups appear.

This detaches and reattaches in one go, which rebuilds the groups the same way without the empty frame in between.

Related Issue

None opened.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 📝 Documentation update
  • ♻️ Refactor
  • 🧪 Test
  • 🔧 Chore / maintenance

Checklist

  • This PR is not from my main branch
  • Tested with WinUI target (in an app: grouping toggled on and off repeatedly with the groups correct each time, and nested grouping from the column menus no longer flickers)
  • Tested with Uno Platform target (the change is inside the Windows-only grouping code)
  • Unit / integration tests added or updated (none added; the existing suite passes locally except SelectingARowWithWideDetails_KeepsTheSelectionVisualsOnTheCells, which fails the same way on main on my machine)
  • Documentation updated to reflect changes (not needed)
  • Code follows the project's coding conventions

🤖 Generated with Claude Code

OnCollectionViewPropertyChanged detached ItemsSource, yielded, then reattached it,
so a frame rendered with no items whenever the grouping changed: the table
flickered empty before showing the new groups. Detach and reattach in one go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/TableView.cs
{
_collectionView.CollectionGroups?.VectorChanged += OnCollectionViewGroupDescriptionsChanged;

// Detach and reattach so the ListView rebuilds its groups. Both in one go: yielding between them let a

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think we can remove this comment entirely. The code is straightforward enough, and there's no need to explain the behavior of the removed Task.Yield().

@w-ahmad w-ahmad left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

thank you @AsafMah for your PR.

This branch has not been deployed

No deployments
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.

2 participants