Skip to content

TableGrid: Fix RowsPerPage firing ServerData twice#9463

Merged
ScarletKuro merged 3 commits intoMudBlazor:devfrom
vernou:8298-table-double-serverdata
Jul 20, 2024
Merged

TableGrid: Fix RowsPerPage firing ServerData twice#9463
ScarletKuro merged 3 commits intoMudBlazor:devfrom
vernou:8298-table-double-serverdata

Conversation

@vernou
Copy link
Member

@vernou vernou commented Jul 20, 2024

Description

Currently, when MudTable.RowsPerPage is modified, MudTable.ServerData is called two time.

First because MudTable.CurrentPage is reset to 0.
Second because MudTable.RowsPerPage is modified.

This PR modify this behavior to call only one time MudTable.ServerData when MudTable.RowsPerPage is modified.
The modification is MudTable.RowsPerPage reset the field MudTable._currentPage to 0 instead of the property.

Fixes #8298
Similar to #9448

Also rework DataGridTests.SetRowsPerPageAsync_CallOneTimeServerData

How Has This Been Tested?

I added a test to reproduce the bug.

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 20, 2024
@ScarletKuro
Copy link
Member

I only see the changes to the tests, did you forgot to push changes for MudTable?

@vernou
Copy link
Member Author

vernou commented Jul 20, 2024

Just out of habit, first commit to demonstrate the bug with a test that fail and a second to fix it.

@codecov
Copy link

codecov bot commented Jul 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.57%. Comparing base (28bc599) to head (033c61b).
Report is 372 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #9463      +/-   ##
==========================================
+ Coverage   89.82%   90.57%   +0.74%     
==========================================
  Files         412      405       -7     
  Lines       11878    12713     +835     
  Branches     2364     2462      +98     
==========================================
+ Hits        10670    11515     +845     
+ Misses        681      638      -43     
- Partials      527      560      +33     

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

@vernou
Copy link
Member Author

vernou commented Jul 20, 2024

@ScarletKuro, can you review this PR?

@ScarletKuro ScarletKuro merged commit c2ab561 into MudBlazor:dev Jul 20, 2024
@ScarletKuro
Copy link
Member

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.

MudTable with MudTablePager ServerData method firing twice when changing RowsPerPage

2 participants