Skip to content

Commit

Permalink
remove isTouched from everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
slax57 committed Apr 18, 2024
1 parent 69e9035 commit e1ada45
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 19 deletions.
6 changes: 1 addition & 5 deletions docs/Inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -998,11 +998,7 @@ import { Select, MenuItem } from "@mui/material";
import { InputProps, useInput } from "react-admin";

const SexInput = (props: InputProps) => {
const {
field,
fieldState: { isTouched, invalid, error },
formState: { isSubmitted },
} = useInput(props);
const { field } = useInput(props);

return (
<Select label="Sex" {...field}>
Expand Down
6 changes: 1 addition & 5 deletions docs/useInput.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ import MenuItem from '@mui/material/MenuItem';
import { useInput } from 'react-admin';

const SexInput = props => {
const {
field,
fieldState: { isTouched, invalid, error },
formState: { isSubmitted }
} = useInput(props);
const { field } = useInput(props);

return (
<Select
Expand Down
5 changes: 0 additions & 5 deletions packages/ra-ui-materialui/src/input/DatagridInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,6 @@ export const DatagridInput = (props: DatagridInputProps) => {
</>
)}
<InputHelperText
touched={
fieldState.isTouched ||
formState.isSubmitted ||
fetchError
}
error={fieldState.error?.message || fetchError?.message}
/>
</ListContextProvider>
Expand Down
3 changes: 1 addition & 2 deletions packages/ra-ui-materialui/src/input/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export const TextInput = (props: TextInputProps) => {
} = props;
const {
field,
fieldState: { error, invalid, isTouched },
formState: { isSubmitted },
fieldState: { error, invalid },
id,
isRequired,
} = useInput({
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-ui-materialui/src/input/TranslatableInputsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const TranslatableInputsTab = (
props: TranslatableInputsTabProps & TabProps
) => {
const { groupKey = '', locale, ...rest } = props;
const { isValid, isTouched } = useFormGroup(`${groupKey}${locale}`);
const { isValid } = useFormGroup(`${groupKey}${locale}`);
const translate = useTranslate();

return (
Expand All @@ -23,7 +23,7 @@ export const TranslatableInputsTab = (
_: capitalize(locale),
})}
className={clsx(TranslatableInputsTabClasses.root, {
[TranslatableInputsTabClasses.error]: !isValid && isTouched,
[TranslatableInputsTabClasses.error]: !isValid,
})}
{...rest}
/>
Expand Down

0 comments on commit e1ada45

Please sign in to comment.