#1247 Fix grid filter in network latency conditions when using blazor server #1248
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix Grid Filter Typing Experience (Character Loss)
Summary
This PR addresses an issue where characters were being lost when typing quickly into the Grid column filters. The manual
@oninputevent handling caused re-renders that interfered with the input state, particularly during rapid typing.This change replaces the manual event handling with Blazor's two-way
@bind-valuebinding, which correctly manages the input state and cursor position during updates.Changes
GridColumnFilter.razor
value="@filterValue" @oninput="..."binding with@bind-value="filterValue" @bind-value:event="oninput"for:@onchange)DateandDateTimeinputs due to Blazor type conversion limitations, but optimized the handler (OnFilterValueInput) to minimize impact.GridColumnFilter.razor.cs
filterValuefield to a property with a setter.GridColumnFilterChangedevent when the value changes, ensuring consistent behavior with the two-way binding.OnFilterValueChangedAsyncmethod.OnEnumFilterValueChangedAsyncandOnFilterOperatorChangedAsyncto prevent duplicate event firing.Problem Addressed
Previously, the manual
@oninputhandler triggered a re-render on every keystroke. If the user typed another character before the re-render completed, the input value in the DOM could be overwritten by the old state from the server/wasm, causing the new character to be lost or the cursor to jump.By switching to
@bind-value, Blazor's internal diffing mechanism handles the input state more intelligently, preserving the user's input and cursor position.Related Issues
Verification