Repository navigation
Rollup PRs #4677 and and #4678 #4680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -429,6 +429,7 @@ public partial class FluentDataGrid<TGridItem> : FluentComponentBase, IHandleEve | |||||||||||||||||||
|
|
||||||||||||||||||||
| private GridItemsProvider<TGridItem>? _lastAssignedItemsProvider; | ||||||||||||||||||||
| private CancellationTokenSource? _pendingDataLoadCancellationTokenSource; | ||||||||||||||||||||
| private bool _isFirstVirtualizeProviderCall = true; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| private Exception? _lastError; | ||||||||||||||||||||
| private GridItemsProviderRequest<TGridItem>? _lastRequest; | ||||||||||||||||||||
|
|
@@ -889,9 +890,15 @@ private async Task RefreshDataCoreAsync() | |||||||||||||||||||
| _lastRefreshedPaginationState = Pagination; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Debounce the requests. This eliminates a lot of redundant queries at the cost of slight lag after interactions. | ||||||||||||||||||||
| // TODO: Consider making this configurable, or smarter (e.g., doesn't delay on first call in a batch, then the amount | ||||||||||||||||||||
| // of delay increases if you rapidly issue repeated requests, such as when scrolling a long way) | ||||||||||||||||||||
| await Task.Delay(100); | ||||||||||||||||||||
| // Skip the delay on the first call to avoid unnecessary lag on initial load. | ||||||||||||||||||||
| if (_isFirstVirtualizeProviderCall) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| _isFirstVirtualizeProviderCall = false; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
892
to
+897
|
||||||||||||||||||||
| else | ||||||||||||||||||||
| { | ||||||||||||||||||||
| await Task.Delay(100); | ||||||||||||||||||||
|
||||||||||||||||||||
| await Task.Delay(100); | |
| try | |
| { | |
| await Task.Delay(100, request.CancellationToken); | |
| } | |
| catch (System.OperationCanceledException) | |
| { | |
| return default; | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -46,7 +46,7 @@ public virtual IEnumerable<Message> AllMessages | |||||||||||||||||||||
| MessageLock.EnterReadLock(); | ||||||||||||||||||||||
| try | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| return MessageList; | ||||||||||||||||||||||
| return MessageList.ToList(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| finally | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
|
|
@@ -66,11 +66,19 @@ public virtual IEnumerable<Message> MessagesToShow(int count = 5, string? sectio | |||||||||||||||||||||
| MessageLock.EnterReadLock(); | ||||||||||||||||||||||
| try | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| var messages = string.IsNullOrEmpty(section) | ||||||||||||||||||||||
| ? MessageList | ||||||||||||||||||||||
| : MessageList.Where(x => x.Section == section); | ||||||||||||||||||||||
| IEnumerable<Message> messages = MessageList; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return count > 0 ? messages.Take(count) : messages; | ||||||||||||||||||||||
| if (!string.IsNullOrEmpty(section)) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| messages = messages.Where(x => x.Section == section); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if (count > 0) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| messages = messages.Take(count); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return messages.ToList(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| finally | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
|
|
@@ -128,7 +136,7 @@ public Message ShowMessageBar(string title, MessageIntent intent, string section | |||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Show a message based on the provided parameters in a message bar. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| /// <param name="title"> Main info. | ||||||||||||||||||||||
| /// <param name="title"> Main info. | ||||||||||||||||||||||
| /// Using MarkupString can introduce XSS vulnerabilities because it renders unencoded HTML. | ||||||||||||||||||||||
| /// Only use it with fully trusted, sanitized content.</param> | ||||||||||||||||||||||
| /// <param name="intent">Intent of the message</param> | ||||||||||||||||||||||
|
|
@@ -223,7 +231,7 @@ public async Task<Message> ShowMessageBarAsync(string title, MessageIntent inten | |||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Show a message based on the provided parameters in a message bar. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| /// <param name="title"> Main info. | ||||||||||||||||||||||
| /// <param name="title"> Main info. | ||||||||||||||||||||||
| /// Using MarkupString can introduce XSS vulnerabilities because it renders unencoded HTML. | ||||||||||||||||||||||
| /// Only use it with fully trusted, sanitized content.</param> | ||||||||||||||||||||||
| /// <param name="intent">Intent of the message</param> | ||||||||||||||||||||||
|
|
@@ -263,7 +271,10 @@ public virtual async Task<Message> ShowMessageBarAsync(Action<MessageOptions> op | |||||||||||||||||||||
| MessageLock.ExitWriteLock(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| await OnMessageItemsUpdatedAsync!.Invoke(); | ||||||||||||||||||||||
| if (OnMessageItemsUpdatedAsync is { } handler) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| await handler.Invoke(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return message; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
@@ -326,10 +337,7 @@ private void NavigationManager_LocationChanged(object? sender, LocationChangedEv | |||||||||||||||||||||
| /// <summary /> | ||||||||||||||||||||||
| public void Dispose() | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| if (_navigationManager != null) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| _navigationManager.LocationChanged -= NavigationManager_LocationChanged; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| _navigationManager?.LocationChanged -= NavigationManager_LocationChanged; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| RemoveMessageItems(section: null); | ||||||||||||||||||||||
|
||||||||||||||||||||||
| RemoveMessageItems(section: null); | |
| MessageLock.EnterWriteLock(); | |
| try | |
| { | |
| RemoveMessageItems(section: null); | |
| } | |
| finally | |
| { | |
| MessageLock.ExitWriteLock(); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_isFirstVirtualizeProviderCallis never reset when the data source or virtualization mode changes. IfItemsProvider/Itemsis replaced orVirtualizeis toggled off/on, the first provider call after that change will be debounced even though it’s effectively a new initial load. Consider resetting this flag whendataSourceHasChangedis true and/or when_lastVirtualizationModechanges totrue.