MudBlazor/MudBlazor

Mask Slow Performance and Inaccurate Input on Blazor Server

Offen

#6.280 geöffnet am 04.02.2023

 (7 Kommentare) (5 Reaktionen) (0 zugewiesene Personen)C# (1.631 Forks)batch import
blazor: serverbughas workaroundhelp wantedperformance

Repository-Metriken

Stars
 (10.394 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 6T 6h) (108 gemergte PRs in 30 T)

Beschreibung

Bug type

Component

Component name

MudTextField

What happened?

I have experienced significant lag when using masks on the MudTextField while debugging a Blazor Server project which always produces incorrect values compared to actual keys pressed. I was able to reproduce this issue by cloning the MudBlazor repository and debugging the Blazor Server project. This is not a problem when running the Blazor WASM project. I also noticed that the site deployed to mudblazor.com is WASM which is why the Masking section in documentation works so well. I have a feeling that this is related to SignalR performance based on the current strategy of cursor manipulation to achieve the mask effect.

Expected behavior

As you press keys moderately quickly, you see the cursor move left as a character is input and attempt to move back to end. However, if you type too quickly (easy to do), the output is not accurate to what was typed. For example, when using the PatternMask "0000-0000-0000-0000", if you were to type 1234 repeatedly, the expected result would be 1234-1234-1234-1234 but can result in 1234-2314-3241-3421 (varying each attempt).

Reproduction link

https://try.mudblazor.com/snippet/GOmdYQkSLTSUAIGW

Reproduction steps

  1. Clone MudBlazor repo.
  2. Debug new instance of Blazor Server project.
  3. Navigate to Features > Masking page.
  4. In the first example for credit card number, type '1234' (not using numpad) very quickly, repeatedly.
  5. Watch cursor lag and input be inaccurate. ...

Relevant log output

No response

Version (bug)

6.1.8

Version (working)

No response

What browsers are you seeing the problem on?

Microsoft Edge

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Code of Conduct

  • I agree to follow this project's Code of Conduct

Contributor Guide