Example Repo - https://github.com/benhysell/BlazorGridPagingIssue
tldr - OnRead args do not contain the correct page after restoring state without manual intervention.
Project Setup
- Base Blazor Client/Server template with Weather Forecasts as the data
- Server has a single OData endpoint to return 50 weather forecasts. Each forecast starts with Temperature 0 and adds 1 per row to allow one to know which page they should be on
- Client has two pages configured, 'Paging NOT Working' and 'Paging Work Around'
Steps to Reproduce
- Navigate to 'Page NOT Working', select a page, i.e. page 5, navigate to the Counter page, navigate back to Page NOT Working.
- Grid will show Page 5 in the page selector, however the data being show in from Page 1
- Looking at Chrome 'Network' tab the OData query to obtain data from the backend does not contain proper offset for Page 5 data
- args.Request.Page reports Page 1, however the state of the Grid was just restored to Page 5
Workaround
I currently have a work around, this can be seen in the other page 'Paging Work Around'.
- On the first call to OnRead I check to see the last Grid state that was stored
- If the arg.GridState.Page does not match, (Stored vs the Request) I update the Request with the proper Page
- Proper OData query is generated to the backend.
Expected Behavior
- After state is restored first call to OnRead() would report the proper Page and make correct OData call.