Repository navigation
How to fix "Fast clicking bug"? #5447
Replies: 2 comments 2 replies
|
I reproduced this on the Listbox demo page and traced it. It isn't Blazor itself. It's a feedback loop between the server render and the listbox's own change detection, and it doesn't settle on its own. What I measured (headless Chromium against https://fluentui-blazor.net/Lists/Listbox, alternating clicks on Red and Green 15 times, then no input at all):
Why it loops
The observer can't tell a user's click from a server render, because both change the same attributes:
That's why you see the styles cycling, and why your concern is valid: any handler bound to the selection runs again on every cycle. What you can do now
I only verified the Listbox. TreeView may have the same cause, but I didn't confirm it. |
|
Can either of you create a proper issue (with reproduction code/steps) for this. We want to keep issues and discussions separate. Thanks. |
Uh oh!
There was an error while loading. Please reload this page.
Many components suffer from an annoying bug that manifests when rapidly clicking on their elements.
This bug prevents the component from synchronizing the state of its child elements, resulting in an infinite re-rendering loop.
I am not sure what is happening internally, but on the screen, I see the interface elements' styles rapidly changing without any further user interaction.
You can reproduce this bug yourself—with a bit of practice—on the following pages:
Try rapidly clicking on two adjacent items in the tree or list.
It seems to me that such behavior is not merely unseemly but potentially dangerous—for instance, if the server performs calculations, accesses a database, or the like, in response to a change in component state.
I realize this is likely a Blazor issue rather than a FluentUI one, but is there a way to prevent this component behavior?
All reactions