Skip to content

Commit 517993f

Browse files
fix: fix admin reviews list misconfigured rating filter (#431)
1 parent 5441587 commit 517993f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pwa/components/admin/review/RatingInput.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ import {
66
import Rating, { type RatingProps } from "@mui/material/Rating";
77

88
export type RatingInputProps = RatingProps &
9-
Omit<CommonInputProps, "source"> &
9+
CommonInputProps &
1010
Omit<ResettableTextFieldProps, "label" | "helperText">;
1111

1212
export const RatingInput = (props: RatingInputProps) => {
1313
const {
1414
field: { ref, ...field },
15-
} = useInput({ ...props, source: "rating" });
15+
} = useInput(props);
1616
const value = Number(field.value);
1717
// Error with "helperText" and "validate" props: remove them from the Rating component
1818
const { helperText, validate, ...rest } = props;
1919

2020
return (
2121
<Labeled label="Rating">
22-
<Rating {...rest} {...field} size="medium" value={value} />
22+
<Rating {...rest} {...field} value={value} />
2323
</Labeled>
2424
);
2525
};

pwa/components/admin/review/ReviewsEdit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ export const ReviewsEdit = () => (
3636
source="body"
3737
style={{ width: 500 }}
3838
/>
39-
<RatingInput validate={required()} style={{ width: 500 }} />
39+
<RatingInput name="rating" validate={required()} source="rating" size="medium" style={{ width: 500 }}/>
4040
</EditGuesser>
4141
);

pwa/components/admin/review/ReviewsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const filters = [
4949
style={{ width: 300 }}
5050
/>
5151
</ReferenceInput>,
52-
<RatingInput key="rating" />,
52+
<RatingInput name="rating" source="rating" key="rating" size="medium" />,
5353
];
5454

5555
export const ReviewsList = () => (

0 commit comments

Comments
 (0)