2.5 regression checking
sosukesuzuki opened this issue · 3 comments
sosukesuzuki commented
2.5 regression checking
sosukesuzuki commented
run 2.4.1
github-actions commented
prettier/prettier@2.4.1 VS prettier/prettier@main
- babel/babel@2d9de5f
- vuejs/eslint-plugin-vue@9c3b117
- excalidraw/excalidraw@8df1a11
- prettier/prettier@babe5ac
- marmelab/react-admin@8ad8f0d
- typescript-eslint/typescript-eslint@f3021c9
- vega/vega-lite@144acfd
Diff (384 lines)
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
index ff82848..7024be9 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
@@ -176,31 +176,36 @@ export interface ReferenceArrayFieldViewProps
classes?: ClassesOverride<typeof useStyles>;
}
-export const ReferenceArrayFieldView: FC<
- ReferenceArrayFieldViewProps
-> = props => {
- const { children, pagination, className, resource, reference, ...rest } =
- props;
- const classes = useStyles(props);
- const { loaded } = useListContext(props);
-
- if (!loaded) {
- return <LinearProgress className={classes.progress} />;
- }
-
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- className,
- resource,
- })}{' '}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination, sanitizeFieldRestProps(rest))}
- </>
- );
-};
+export const ReferenceArrayFieldView: FC<ReferenceArrayFieldViewProps> =
+ props => {
+ const {
+ children,
+ pagination,
+ className,
+ resource,
+ reference,
+ ...rest
+ } = props;
+ const classes = useStyles(props);
+ const { loaded } = useListContext(props);
+
+ if (!loaded) {
+ return <LinearProgress className={classes.progress} />;
+ }
+
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ className,
+ resource,
+ })}{' '}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination, sanitizeFieldRestProps(rest))}
+ </>
+ );
+ };
ReferenceArrayFieldView.propTypes = {
basePath: PropTypes.string,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
index 523738a..65ba764 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
@@ -156,23 +156,22 @@ ReferenceManyField.defaultProps = {
addLabel: true,
};
-export const ReferenceManyFieldView: FC<
- ReferenceManyFieldViewProps
-> = props => {
- const { basePath, children, pagination, reference, ...rest } = props;
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- basePath,
- resource: reference,
- })}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination)}
- </>
- );
-};
+export const ReferenceManyFieldView: FC<ReferenceManyFieldViewProps> =
+ props => {
+ const { basePath, children, pagination, reference, ...rest } = props;
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ basePath,
+ resource: reference,
+ })}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination)}
+ </>
+ );
+ };
export interface ReferenceManyFieldViewProps
extends Omit<
diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
index 885329b..41e43b2 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
@@ -80,139 +80,142 @@ import { ClassesOverride } from '../types';
*
* The object passed as `options` props is passed to the material-ui <Checkbox> components
*/
-const CheckboxGroupInput: FunctionComponent<
- CheckboxGroupInputProps
-> = props => {
- const {
- choices = [],
- className,
- classes: classesOverride,
- format,
- helperText,
- label,
- loaded,
- loading,
- margin = 'dense',
- onBlur,
- onChange,
- onFocus,
- optionText,
- optionValue,
- options,
- parse,
- resource,
- row,
- source,
- translate,
- translateChoice,
- validate,
- ...rest
- } = props;
- const classes = useStyles(props);
+const CheckboxGroupInput: FunctionComponent<CheckboxGroupInputProps> =
+ props => {
+ const {
+ choices = [],
+ className,
+ classes: classesOverride,
+ format,
+ helperText,
+ label,
+ loaded,
+ loading,
+ margin = 'dense',
+ onBlur,
+ onChange,
+ onFocus,
+ optionText,
+ optionValue,
+ options,
+ parse,
+ resource,
+ row,
+ source,
+ translate,
+ translateChoice,
+ validate,
+ ...rest
+ } = props;
+ const classes = useStyles(props);
- warning(
- source === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
- );
-
- warning(
- choices === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
- );
+ warning(
+ source === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
+ );
- const {
- id,
- input: { onChange: finalFormOnChange, onBlur: finalFormOnBlur, value },
- isRequired,
- meta: { error, submitError, touched },
- } = useInput({
- format,
- onBlur,
- onChange,
- onFocus,
- parse,
- resource,
- source,
- validate,
- ...rest,
- });
+ warning(
+ choices === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
+ );
- const handleCheck = useCallback(
- (event, isChecked) => {
- let newValue;
- try {
- // try to convert string value to number, e.g. '123'
- newValue = JSON.parse(event.target.value);
- } catch (e) {
- // impossible to convert value, e.g. 'abc'
- newValue = event.target.value;
- }
- if (isChecked) {
- finalFormOnChange([...(value || []), ...[newValue]]);
- } else {
- finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
- }
- finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
- },
- [finalFormOnChange, finalFormOnBlur, value]
- );
+ const {
+ id,
+ input: {
+ onChange: finalFormOnChange,
+ onBlur: finalFormOnBlur,
+ value,
+ },
+ isRequired,
+ meta: { error, submitError, touched },
+ } = useInput({
+ format,
+ onBlur,
+ onChange,
+ onFocus,
+ parse,
+ resource,
+ source,
+ validate,
+ ...rest,
+ });
- if (loading) {
- return (
- <Labeled
- label={label}
- source={source}
- resource={resource}
- className={className}
- isRequired={isRequired}
- margin={margin}
- >
- <LinearProgress />
- </Labeled>
+ const handleCheck = useCallback(
+ (event, isChecked) => {
+ let newValue;
+ try {
+ // try to convert string value to number, e.g. '123'
+ newValue = JSON.parse(event.target.value);
+ } catch (e) {
+ // impossible to convert value, e.g. 'abc'
+ newValue = event.target.value;
+ }
+ if (isChecked) {
+ finalFormOnChange([...(value || []), ...[newValue]]);
+ } else {
+ finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
+ }
+ finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
+ },
+ [finalFormOnChange, finalFormOnBlur, value]
);
- }
- return (
- <FormControl
- component="fieldset"
- margin={margin}
- error={touched && !!(error || submitError)}
- className={classnames(classes.root, className)}
- {...sanitizeRestProps(rest)}
- >
- <FormLabel component="legend" className={classes.label}>
- <FieldTitle
+ if (loading) {
+ return (
+ <Labeled
label={label}
source={source}
resource={resource}
+ className={className}
isRequired={isRequired}
- />
- </FormLabel>
- <FormGroup row={row}>
- {choices.map(choice => (
- <CheckboxGroupInputItem
- key={get(choice, optionValue)}
- choice={choice}
- id={id}
- onChange={handleCheck}
- options={options}
- optionText={optionText}
- optionValue={optionValue}
- translateChoice={translateChoice}
- value={value}
+ margin={margin}
+ >
+ <LinearProgress />
+ </Labeled>
+ );
+ }
+
+ return (
+ <FormControl
+ component="fieldset"
+ margin={margin}
+ error={touched && !!(error || submitError)}
+ className={classnames(classes.root, className)}
+ {...sanitizeRestProps(rest)}
+ >
+ <FormLabel component="legend" className={classes.label}>
+ <FieldTitle
+ label={label}
+ source={source}
+ resource={resource}
+ isRequired={isRequired}
/>
- ))}
- </FormGroup>
- <FormHelperText>
- <InputHelperText
- touched={touched}
- error={error || submitError}
- helperText={helperText}
- />
- </FormHelperText>
- </FormControl>
- );
-};
+ </FormLabel>
+ <FormGroup row={row}>
+ {choices.map(choice => (
+ <CheckboxGroupInputItem
+ key={get(choice, optionValue)}
+ choice={choice}
+ id={id}
+ onChange={handleCheck}
+ options={options}
+ optionText={optionText}
+ optionValue={optionValue}
+ translateChoice={translateChoice}
+ value={value}
+ />
+ ))}
+ </FormGroup>
+ <FormHelperText>
+ <InputHelperText
+ touched={touched}
+ error={error || submitError}
+ helperText={helperText}
+ />
+ </FormHelperText>
+ </FormControl>
+ );
+ };
const sanitizeRestProps = ({
refetch,
sosukesuzuki commented
2.5 has been released