Skip to content

Commit

Permalink
fix code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
usavkov-epam committed Nov 15, 2023
1 parent caafd45 commit 2b159ab
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const BankingInformationField = ({

return acc;
}, []);
}, [addressCategoryIdsSet, categories]);
}, [addressCategoryIdsSet, categories, initCategoryId]);

return (
<Card headerStart={cardHeader}>
Expand Down Expand Up @@ -115,8 +115,8 @@ BankingInformationField.propTypes = {
label: PropTypes.string,
value: PropTypes.string,
})).isRequired,
categoriesOptions: PropTypes.arrayOf(PropTypes.shape({
label: PropTypes.string,
categories: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.string,
value: PropTypes.string,
})).isRequired,
fields: PropTypes.object.isRequired,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import { useEffect } from 'react';
import { useForm } from 'react-final-form';

Expand Down Expand Up @@ -40,3 +41,7 @@ export const BankingInformationFieldArray = (props) => {

return <RepeatableFieldWithValidation {...props} />;
};

BankingInformationFieldArray.propTypes = {
fields: PropTypes.object.isRequired,
};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { BankingInformationFieldArray } from './BankingInformationFieldArray'
export { BankingInformationFieldArray } from './BankingInformationFieldArray';
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export const getAddressCategoryIdsSet = memoize((addresses = []) => {

return acc;
}, new Set());
})
});
13 changes: 11 additions & 2 deletions src/Organizations/useBankingInformationManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export const useBankingInformationManager = () => {
} = getArrayItemsChanges(initBankingInformation, bankingInformation);

return Promise.all([
executeSequentially(createBankingInformation, created.map((item) => ({ organizationId: organization.id, ...item }))),
executeSequentially(createBankingInformation, created.map((item) => ({
organizationId: organization.id,
...item,
}))),
executeParallel(updateBankingInformation, updated),
executeParallel(deleteBankingInformation, deleted),
]).catch(() => {
Expand All @@ -52,7 +55,13 @@ export const useBankingInformationManager = () => {
messageId: 'ui-organizations.bankingInformation.save.error',
});
});
}, [showCallout]);
}, [
createBankingInformation,
deleteBankingInformation,
isBankingInformationEnabled,
showCallout,
updateBankingInformation,
]);

return {
manageBankingInformation,
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/CategoryDropdown/CategoryDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function CategoryDropdown({
change(fieldName, value);

if (onChangeProp) onChangeProp(value);
}, [onChangeProp]);
}, [change, fieldName, onChangeProp]);

return (
<FieldMultiSelectionFinal
Expand Down

0 comments on commit 2b159ab

Please sign in to comment.