mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
fix: optimize item form performance.
This commit is contained in:
@@ -1,24 +1,15 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
Button,
|
||||
Intent,
|
||||
FormGroup,
|
||||
Checkbox
|
||||
} from '@blueprintjs/core';
|
||||
import React, { memo } from 'react';
|
||||
import { Button, Intent, FormGroup, Checkbox } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { saveInvoke } from 'utils';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { ErrorMessage, FastField } from 'formik';
|
||||
import { CLASSES } from 'common/classes';
|
||||
|
||||
/**
|
||||
* Item form floating actions.
|
||||
*/
|
||||
export default function ItemFormFloatingActions({
|
||||
isSubmitting,
|
||||
itemId,
|
||||
onCancelClick
|
||||
}) {
|
||||
export default function ItemFormFloatingActions({ isSubmitting, itemId, onCancelClick }) {
|
||||
const handleCancelBtnClick = (event) => {
|
||||
saveInvoke(onCancelClick, event.currentTarget.value);
|
||||
};
|
||||
@@ -37,18 +28,24 @@ export default function ItemFormFloatingActions({
|
||||
</Button>
|
||||
|
||||
{/*----------- Active ----------*/}
|
||||
<FormGroup
|
||||
label={' '}
|
||||
inline={true}
|
||||
className={'form-group--active'}
|
||||
>
|
||||
<Checkbox
|
||||
inline={true}
|
||||
label={<T id={'active'} />}
|
||||
// defaultChecked={values.active}
|
||||
// {...getFieldProps('active')}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FastField name={'type'}>
|
||||
{({ field, field: { value } }) => (
|
||||
<FormGroup label={' '} inline={true} className={'form-group--active'}>
|
||||
<Checkbox
|
||||
inline={true}
|
||||
label={<T id={'active'} />}
|
||||
defaultChecked={value}
|
||||
{...field}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// function areEqual(prevProps, nextProps) {
|
||||
// return prevProps.isSubmitting === nextProps.isSubmitting;
|
||||
// }
|
||||
|
||||
// export default memo(ItemFormFloatingActions, areEqual);
|
||||
|
||||
Reference in New Issue
Block a user