Skip to content
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(input): Set DateInput and DateTimeInput to uncontrolled input #9543

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

arimet
Copy link
Contributor

@arimet arimet commented Dec 22, 2023

Fix #9330

}
}, [setRenderCount, parse, field]);

const { onBlur: onBlurFromField } = field;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have a different logic for onBlur and onFocus?

const renderHelperText =
helperText !== false || ((isTouched || isSubmitted) && invalid);

const { ref, name } = field;

console.log('field', field);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log spotted

@@ -133,7 +211,8 @@ const getStringFromDate = (value: string | Date) => {
// null, undefined and empty string values should not go through dateFormatter
// otherwise, it returns undefined and will make the input an uncontrolled one.
if (value == null || value === '') {
return '';
console.log('toto');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log spotted

return (
<TextField
id={id}
{...field}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove {...field} ?

@slax57
Copy link
Contributor

slax57 commented Jan 4, 2024

I'm afraid you brought a regression to the DateInput component:

Capture.video.2024-01-04.11.52.30.mp4

@slax57 slax57 removed their assignment Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DateTimeInput or DateInput reinitialise when typing a date starting with '0' - only on Firefox
4 participants