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 demo Review Edit warning due to missing EditContext #5780

Merged
merged 1 commit into from
Jan 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 31 additions & 16 deletions examples/demo/src/reviews/ReviewEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import { FC } from 'react';
import {
useEditController,
EditContextProvider,
useTranslate,
TextInput,
SimpleForm,
Expand Down Expand Up @@ -64,22 +65,36 @@ const ReviewEdit: FC<Props> = ({ onCancel, ...props }) => {
<CloseIcon />
</IconButton>
</div>
<SimpleForm
className={classes.form}
basePath={controllerProps.basePath}
record={controllerProps.record}
save={controllerProps.save}
version={controllerProps.version}
redirect="list"
resource="reviews"
toolbar={<ReviewEditToolbar />}
>
<CustomerReferenceField formClassName={classes.inlineField} />
<ProductReferenceField formClassName={classes.inlineField} />
<DateField source="date" formClassName={classes.inlineField} />
<StarRatingField formClassName={classes.inlineField} />
<TextInput source="comment" rowsMax={15} multiline fullWidth />
</SimpleForm>
<EditContextProvider value={controllerProps}>
<SimpleForm
className={classes.form}
basePath={controllerProps.basePath}
record={controllerProps.record}
save={controllerProps.save}
version={controllerProps.version}
redirect="list"
resource="reviews"
toolbar={<ReviewEditToolbar />}
>
<CustomerReferenceField
formClassName={classes.inlineField}
/>
<ProductReferenceField
formClassName={classes.inlineField}
/>
<DateField
source="date"
formClassName={classes.inlineField}
/>
<StarRatingField formClassName={classes.inlineField} />
<TextInput
source="comment"
rowsMax={15}
multiline
fullWidth
/>
</SimpleForm>
</EditContextProvider>
</div>
);
};
Expand Down