Skip to content

MudDataGrid: Fix Column ungroup#9344

Merged
henon merged 2 commits intoMudBlazor:devfrom
ScarletKuro:grouping
Jul 9, 2024
Merged

MudDataGrid: Fix Column ungroup#9344
henon merged 2 commits intoMudBlazor:devfrom
ScarletKuro:grouping

Conversation

@ScarletKuro
Copy link
Member

@ScarletKuro ScarletKuro commented Jul 8, 2024

Description

Fixes: #9341

Also replacing (where noticed):

await property?.MethodAsync();

with:

if (property is not null)
{
    await property.MethodAsync(true);
}

Because the first version generates:

awaiter = ((property != null) ? property.MethodAsync() : null).GetAwaiter();
if (!awaiter.IsCompleted)

which is equivalent to:

var task = property?.MethodAsync();
await task;

This means that task can be null and will lead to an exception. The second version avoids this problem.

How Has This Been Tested?

Will add later

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@github-actions github-actions bot added bug Unexpected behavior or functionality not working as intended PR: needs review labels Jul 8, 2024
@codecov
Copy link

codecov bot commented Jul 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.74%. Comparing base (28bc599) to head (8e6f41d).
Report is 330 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #9344      +/-   ##
==========================================
+ Coverage   89.82%   90.74%   +0.91%     
==========================================
  Files         412      403       -9     
  Lines       11878    12665     +787     
  Branches     2364     2447      +83     
==========================================
+ Hits        10670    11493     +823     
+ Misses        681      619      -62     
- Partials      527      553      +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ScarletKuro
Copy link
Member Author

Added test case

@ScarletKuro ScarletKuro requested a review from henon July 8, 2024 22:23
@ScarletKuro
Copy link
Member Author

@henon I hope you don't mind that I referenced MudBlazor.Examples.Data in MudBlazor.UnitTests.Viewer. I was surprised it wasn't referenced already. I just wanted to copy-paste the provided reproduction, and when I tried to use the existing DataGridColumnGroupingTest, the problem wouldn't appear since this bug is specific to server data and certain configurations. So, I went with the path of least resistance.

@henon henon merged commit 7001ab2 into MudBlazor:dev Jul 9, 2024
@henon
Copy link
Contributor

henon commented Jul 9, 2024

I agree. Definitely better than duplicating code. Thanks!

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

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MudDataGrid: UnGroup does not refresh the view of the datagrid

2 participants