Skip to content

Commit b05a1a0

Browse files
committed
[no ci] minor improvements to story
1 parent 5d339c8 commit b05a1a0

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

packages/ra-ui-materialui/src/form/FormDataConsumer.stories.tsx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,28 @@ export const Basic = () => (
1818
<FormDataConsumer<any>>
1919
{({ formData }) => {
2020
console.log({ formData });
21-
if (!!formData.title) {
22-
return (
23-
<ReferenceInput
24-
source="userId"
25-
reference="users"
26-
>
27-
<AutocompleteInput
28-
shouldUnregister
29-
label="User"
30-
optionText={choice =>
31-
`${choice.name} / (${choice.id})`
32-
}
33-
// optionValue="userId"
34-
noOptionsText="User does'nt exist"
35-
isRequired
36-
validate={[
37-
required('User is Required.'),
38-
]}
39-
/>
40-
</ReferenceInput>
41-
);
42-
} else return null;
21+
if (!formData.title) {
22+
return null;
23+
}
24+
return (
25+
<ReferenceInput
26+
source="userId"
27+
reference="users"
28+
>
29+
<AutocompleteInput
30+
shouldUnregister
31+
label="User"
32+
optionText={choice =>
33+
`${choice.name} / (${choice.id})`
34+
}
35+
noOptionsText="User doesn't exist"
36+
isRequired
37+
validate={[
38+
required('User is required.'),
39+
]}
40+
/>
41+
</ReferenceInput>
42+
);
4343
}}
4444
</FormDataConsumer>
4545
<TextInput source="body" multiline rows={5} />

0 commit comments

Comments
 (0)