Skip to content

MudDataGrid: Do not add duplicate filters#7594

Merged
henon merged 2 commits intoMudBlazor:devfrom
0xced:fix/DataGrid-duplicate-filters
Feb 20, 2024
Merged

MudDataGrid: Do not add duplicate filters#7594
henon merged 2 commits intoMudBlazor:devfrom
0xced:fix/DataGrid-duplicate-filters

Conversation

@0xced
Copy link
Contributor

@0xced 0xced commented Oct 4, 2023

Fixes #6759

Before the fix: clicking three times on the same filter adds three identical filter rows
image

@henon henon changed the title [DataGrid] Do not add duplicate filters MudDataGrid: Do not add duplicate filters Oct 14, 2023
@henon henon added the needs: tests A maintainer has explicitly asked for associated test cases to be added to this pull request label Oct 14, 2023
@henon
Copy link
Contributor

henon commented Oct 14, 2023

Can you add a test case that fails without the fix and passes with it, please? This will make sure your fix will never unintentionally be corrupted by future PRs.

@henon
Copy link
Contributor

henon commented Oct 28, 2023

@0xced This is an important bug fix PR, you are already 90% of the way. If you can complete, we'd appreciate it!

@ScarletKuro
Copy link
Member

ScarletKuro commented Oct 28, 2023

@henon actually, now when I think about it, if you add this to the DataGrid.AddFilterAsync and just compare by the title, you won't be able to do something like this.
example filter
So either you shouldn't allow duplication when clicking the UI add filter like it's done now, or you need more complicated compare that takes not only column title into the account.

@0xced
Copy link
Contributor Author

0xced commented Oct 29, 2023

Another reason not to call DataGrid.AddFilterAsync is because it eventually calls the ServerData callback. I was very surprised to see database query logs just by opening the filter panel, without having defined any filter yet!

Can you add a test case that fails without the fix and passes with it, please? This will make sure your fix will never unintentionally be corrupted by future PRs.

I'll try but I may not have time to do it soon. So if anyone else want to add a test, please go ahead.

@0xced 0xced force-pushed the fix/DataGrid-duplicate-filters branch from 1203631 to 89cad19 Compare October 29, 2023 10:52
@codecov
Copy link

codecov bot commented Oct 29, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (d48ea23) 88.22% compared to head (4edbad8) 88.22%.

Files Patch % Lines
.../MudBlazor/Components/DataGrid/HeaderCell.razor.cs 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #7594   +/-   ##
=======================================
  Coverage   88.22%   88.22%           
=======================================
  Files         394      394           
  Lines       11755    11764    +9     
  Branches     2381     2385    +4     
=======================================
+ Hits        10371    10379    +8     
  Misses        857      857           
- Partials      527      528    +1     

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

@0xced 0xced force-pushed the fix/DataGrid-duplicate-filters branch from 89cad19 to a4d19f0 Compare November 1, 2023 08:40
@henon
Copy link
Contributor

henon commented Feb 19, 2024

@0xced only a missing test case prevents this PR from being released.

@0xced 0xced force-pushed the fix/DataGrid-duplicate-filters branch from a4d19f0 to b016019 Compare February 19, 2024 19:33
@0xced 0xced force-pushed the fix/DataGrid-duplicate-filters branch from b016019 to 4794e08 Compare February 19, 2024 21:59
@0xced
Copy link
Contributor Author

0xced commented Feb 19, 2024

I just added a test case in 4edbad8 so this should be ready to merge.

@henon henon merged commit 4a62d29 into MudBlazor:dev Feb 20, 2024
@henon
Copy link
Contributor

henon commented Feb 20, 2024

Thanks a lot @0xced !

@0xced 0xced deleted the fix/DataGrid-duplicate-filters branch February 20, 2024 10:45
@mikes-gh mikes-gh added bug Unexpected behavior or functionality not working as intended and removed needs: tests A maintainer has explicitly asked for associated test cases to be added to this pull request labels Mar 4, 2024
biegehydra pushed a commit to biegehydra/MudBlazor that referenced this pull request Apr 26, 2024
* DataGrid: Do not add duplicate filters

Fixes MudBlazor#6759

* Add test case ensuring no duplicate filters are added
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.

filter icon click in MudDatagrid have an issue

5 participants