-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: desync of FluentNumberField and FluentSlider in 4.10.4 #2948
Comments
Hi @arazni,
Then there are two issues...Please don't mix multiple issues in one the next time. We'll wait and see what @oneolddev comes up with for the slider. Wrt the NumberField, there is no way I get it to work for both this situation and #2803 at the same time. As I think that last one is more important than being able to manipulate the value from the outside, we won't be able to fix your issue at this time. |
I can confirm the issue you found with Many of the issues that have been filed regarding This is the reason for the existence of the javascript for |
Sorry for the delay, I got very busy and didn't have a chance to get back to this till a couple of days ago. I've just submitted a PR that should resolve your issues. Please let me know if this works for you. |
Looking forward to testing it. |
🐛 Bug Report
Seeming regressions of #1531 and #1450
There are 2 Problems
FluentNumberField
This test demonstrates that the FluentNumberField's two-way data binding is broken in version 4.10.4. This appears to be a regression.
In my web app, I have a component that takes a numeric input and divies a portion to a wallet and a portion to a stash. After a number is selected, a button triggers a command and this command also resets the value of the numeric field to 0.
Unfortunately, the numeric field does not respect the behavior of being reset to 0 by the button command.
Go ahead and select a number like 2, which will enable the reset button. The expected behavior is for the reset button to set the value back to 0, and for the number input field to reflect that value.
You can see in the console logs that the data model's value is reset to 0, however the number field's value is still non-zero both visibly and under the hood. This implies that it isn't respecting the binding.
FluentSlider
This test demonstrates that the FluentSlider's two-way data binding can desync from its bound value in version 4.10.4. This may be a regression.
While you can see the behavior working for the Reset button, the behavior does not always work for the "Change by 2" button.
Go ahead and set the slider to 3, which will enable the reset button (only enabled at 3). Reset. You see that it works.
Go ahead and set the slider to 1, then keep pressing the "Change by 2" button. In addition to the visual weirdness, by checking the console logs, you will see that it desyncs from the actual value in the data.
When I run it, the console logs always have an accurate data value for the "Change by 2" button's usage. The underlying slider value on blazor side is one step behind. And the visual only updates every 3 clicks of the button.
A second test scenario is: 1. Refresh the page. 2. Set the slider to 1. 3. Click "Change by 2". 4. Click Reset. This will break the visual synchronization with the "Reset" button, which is otherwise usually working correctly.
💻 Repro or Code Sample
https://github.com/arazni/blazor-fluent-ui-slider-bug/tree/main
🤔 Expected Behavior
When changing a 2-way bound value outside of the component, the visual and component's value should stay synchronized.
😯 Current Behavior
There are scenarios where the component does not match the underlying data. See the repro steps on the repo.
💁 Possible Solution
🔦 Context
Same as #1531 and #1450, I have buttons that change values nearby fields and sliders that take those changes. See https://arazni.github.io/blades-in-the-sheets/demo for context. You may need to enable sliders over checkboxes in the accessibility tab. Then go back to the demo page, The fund section with the pencil icon enabled is where some of these issues come up.
🌍 Your Environment
The text was updated successfully, but these errors were encountered: