Skip to content

Conversation

miguelhasse
Copy link
Contributor

@miguelhasse miguelhasse commented Sep 30, 2025

Pull Request

📖 Description

This feature introduces two visual enhancements to the DataGrid component while asynchronously loading items from an IQueryable data source:

  1. The 'Loading' state flag is always set to true when requesting items on first time load (or while no items have yet been loaded) providing better visual feedback for users (avoiding empty item messages before loading).
  2. Exceptions that occur when asynchronously requesting items can the caught, depending on the filter parameter 'HandleLoadingError', and displayed in the body of the DataGrid. The exception error rendering can be customized using 'ErrorContent' template.

👩‍💻 Reviewer Notes

A working sample of the 'Loading' state flag feature can be seen in the following samples:

These same samples can be used to see a working sample for the error handling feature by forcing data source connection errors.

✅ Checklist

General

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Component-specific

  • I have added a new component
  • I have added Unit Tests for my new component
  • I have modified an existing component
  • I have validated the Unit Tests for an existing component

@vnbaaij vnbaaij added this to the v4.12.2 milestone Sep 30, 2025
@vnbaaij
Copy link
Collaborator

vnbaaij commented Sep 30, 2025

The FluentDataGrid_With_Empty_Items_Stays_Loading_Until_Changed test is failing with this PR applied.

We cannot just alter the test to make it pass with the new code. That would mean we introduce a breaking change (albeit a small one)

Before (our code):
image

After (your PR code):
image

Please review the PR and make the necessary changes so all tests pass unaltered. Thanks

</FluentDataGridRow>
}

private void RenderErrorContent(RenderTreeBuilder __builder)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We cannot display a default technical error to the user via _lastError.Message. This can lead to serious security issues in production environments.

It is possible to capture a potential exception, but in that case, ErrorContent or a standard message such as "An error occurred while retrieving data" must be displayed.

This RenderErrorContent method needs to be reviewed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dvoituron good point. I'll make the appropriate changes.

@miguelhasse
Copy link
Contributor Author

@vnbaaij I'll check the failing unit test and apply required fixes. Thanks

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.

3 participants