Closed Brimerland closed 1 year ago
I can reproduce the error. No idea yet what is causing this.
Is there any specific reason you are installing the web-components package? It is not needed for the Microsoft.Fast.Components.FluentUI package to do its thing...
Is there any specific reason you are installing the web-components package?
I just installed the package because I needed the web-components version number for this bug report for better reproducibility.
Your "Getting Started" section mentions to use this script element
<script type="module" src="https://cdn.jsdelivr.net/npm/@fluentui/web-components/dist/web-components.min.js"></script>
to get the latest version. (Which i was using.)
But I have no clue to find out which version this 'latest' version is.
So, I installed the npm module to get the web-components.min.js
and the matching version number.
I just installed the package because I needed the web-components version number for this bug report for better reproducibility.
That's good! Hadn't thought about that.
Thid is no longer happening in the latest version. Closing this
π Bug Report
Updating values which are two way bound to a FluentUI component during a "@onclick" callback in a Blazor server app will lead to uncontrolled repeated updates if the callback method did not return before a subsequent call.
This issue does not appear on client side Blazor (blazorwasm)!
π» Repro or Code Sample
The Issue was found using @fluentui/web-components@2.2.3 and Microsoft.Fast.Components.FluentUI 1.1.0.
Use your existing Blazor server app or create a new one following these steps:
dotnet new blazorserver -o BugFluentUIApp
cd BugFluentUIApp
dotnet add package Microsoft.Fast.Components.FluentUI
npm install --save @fluentui/web-components
node_modules/@fluentui\web-components/dist/web-components.min.js
to folderwwwroot/script
<script type="module" src="script/web-components.min.js"></script>
toPages/_Layout.cshtml
at the end of the head sectionComponents
MyItem.razor
insideComponents
folderMyItem.razor
component below<BugFluentUIApp.Components.MyItem/>
toPages/Index.razor
Contents of
MyItem.razor
π€ Expected Behavior
Values which are bound to FluentUI components should only update when changed by user or by component code.
π― Current Behavior
https://user-images.githubusercontent.com/609797/154707861-a55c27d0-ac82-4fc2-a431-11cce1091c7a.mp4
If you press the buttons "Update Blocking" or "Update Blocking Async" in the second row rapidly the bound values keep updating forever. (Even after you have stopped pressing the buttons.)
For comparison a value is bound to a non FluentUI input in the first row. Pressing these buttons do not trigger the issue.
π Possible Solution
-
π¦ Context
If a user triggers this kind of issue the FluentUI components having bound values let the application run wild and not usable anymore. For example a slider or a number field which controls pagination.
π Your Environment