Unable to clear default value in DateTimeInput component
What you were expecting:
Ability to clear default value from <DateTimeInput />
What happened instead: Default value is set back into the input immediately. The user unable to clear default value.
Steps to reproduce: Issue only present in v4.16.12, rolled back to v4.16.11 and issue no longer present. No other code changes have been made reverted or made.
Related code: The code where this was observed in within a form. It calls a sub component that wraps two inputs and very loosely couples them together.
<>
<DateTimeInput
source={startSource}
defaultValue={defaultStartDate}
/>
<DateTimeInput
source={endSource}
defaultValue={
addMinutes(defaultEndDate, endDateAddMinutes) ?? defaultEndDate
}
validate={invalidDateRange(
getValues(startSource),
getValues(endSource),
)}
/>
</>
Other information: I'm happy to make a proper repro, but won't have time until the weekend as flat out at the moment. Thought I'd flag this quickly though, as they release just came out.
Environment
- React-admin version: v4.16.12
- Last version that did not exhibit the issue (if applicable): v4.16.11
- React version: v18.2.x
- Browser: Firefox
Thanks for the quick catch, bug reproduced :+1:
Update: My bad, we can't reproduce this bug. Please provide a reproduction based on the simple example Codesandbox (https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple) or on the Storybook (https://react-admin-storybook.vercel.app/?path=/story/ra-ui-materialui-input-dateinput--basic)
Thanks for looking, I will try and reproduce again, and then attempt to create a repro in the sandbox and update you. 👍
No news for some time, closing.