Closed msb-incom closed 2 weeks ago
@microsoft-github-policy-service agree
@microsoft-github-policy-service agree
That sounds about right. Give me time to check all this before approving the PR. Good work!
It seems it is in fact not passing tests. The reason seems to be that selecting the same month after going to month view will give the same value causing SetCurrentValueAsync
to return early without notifying about the field change. I'll look into alternative options π
I fixed above mentioned problem by extending and utilizing OnSelectedDateHandlerAsync
rather than using SetCurrentValueAsync
. This is now more similar to how it was before my change.
However, an alternative could be to extend FluentInputBase
with the CheckIfSelectedValueHasChanged
from FluentCalendarBase
and use that parameter when checking for value change. However this only seemed to be a requirement for the FluentCalendar, so it didn't seem appropriate to let that requirement go all the way up and mess with the design of the FluentInputBase
π
However, an alternative could be to extend
FluentInputBase
with theCheckIfSelectedValueHasChanged
fromFluentCalendarBase
and use that parameter when checking for value change. However this only seemed to be a requirement for the FluentCalendar, so it didn't seem appropriate to let that requirement go all the way up and mess with the design of theFluentInputBase
π
Yes, let's not do that. π
@dvoituron Thanks for taking the time to review the PR! And let me also use this opportunity to thank you and the other collaborators for providing an incredibly useful library that makes for very swift Blazor development πͺ
Pull Request
π Description
When using a FluentDatePicker or FluentCalender inside an EditContext, there are issues with selecting a new value in the Year-view of the calendar. My diagnosis suggests that this comes down to a race condition-like issue between invoking ValueChanged and also notifying the EditContext about changes which will propagate the "old" value to the component through the parameters being updated.
The changes I propose changes the approach for updating value of the FluentCalendar (and thus FluentDatePicker) by utilizing
SetCurrentValueAsync
available onFluentInputBase
. This approach is similar to other components whereSetCurrentValueAsync
is called as part ofChangeHandlerAsync
.The changes proposed fixes the issue.
π« Issues
https://github.com/microsoft/fluentui-blazor/issues/2046
π©βπ» Reviewer Notes
π Test Plan
I tested all the DatePicker/Calendar examples in the sample project.
β Checklist
General
Component-specific
β Next Steps