Im using Fluent UI web component in my Blazor Server Side project, and when the user types a text into a fluent-text-field
, some of the written text is skipped, is there a fix for it or I should just change all my fluent-text-fields
?
an example can be found here: Example
writing in the field labeled as 'standard' or 'Postal Code autocomplete' will create the issue.
I've taken a look to the source code of Fluent UI. As I expected, it seems they are using the event @oninput
for non multiline text fields: Source:
value=@(BindConverter.FormatValue(CurrentValueAsString))
@oninput=@(EventCallback.Factory.CreateBinder<string?>(this, __value => CurrentValueAsString = __value, CurrentValueAsString))
Because of this, on every character you type, you get some network time before it gets processed and updated on the client side which explains the lags.
This issue should globally not be happening locally or on Blazor WASM because there isn't any network time.
For Multiline text fields, they are using @bind
which doesn't produce the issue:
@bind-value=@CurrentValue
@bind-value:event="oninput"
This link addresses more precisely why @input
can be problematic on Blazor Server Side and the differences with @bind
.
About how you can still use this, unfortunately, I didn't see any parameter that fix this apart from using Multiline text fields. However, it seems the developers of the library will hardly be updating it or improving it. I suggest you consider another library for new developements (Github repository):
We will not be adding any new functionality and bug fixing will be minimal.