ant-design-blazor / ant-design-blazor

🌈A set of enterprise-class UI components based on Ant Design and Blazor.

Home Page:https://antblazor.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DatePicker component lost focus exception

jxcproject opened this issue · comments

When the DatePicker component sets ChangeOnClose and clears content, losing focus will result in an error.
Reproduction steps:

  1. Click on the component with the mouse to place the cursor after the last date value, then press Backspace on the keyboard to delete the content one by one until all content is deleted
  2. When the mouse clicks on a blank area other than a component, causing the component to lose focus, the following exception will be reported

blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Nullable object must have a value.
System.InvalidOperationException: Nullable object must have a value.
at System.Nullable1[[System.DateTime, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].get_Value() at AntDesign.DatePickerBase1.d__239[[System.Nullable1[[System.DateTime, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() at AntDesign.DatePicker1.d__9[[System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

<DatePicker TValue="DateTime?" ChangeOnClose Value="@dateTime" />

@code {
    private DateTime? dateTime = DateTime.Now;
}

Thanks for contacting us @jxcproject , I can't reproduce the issue, could you please post a demo for that?

Hello @jxcproject , this issue have been fixed in 0.19.0