diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b80e2c3..83f86265 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 10.1.0 IN PROGRESS +* React v19: refactor away from default props for functional components. Refs UICIRC-1080. + ## [10.0.1](https://github.com/folio-org/ui-circulation/tree/v10.0.1) (2024-12-04) [Full Changelog](https://github.com/folio-org/ui-circulation/compare/v10.0.0...v10.0.1) diff --git a/src/settings/FinePolicy/components/EditSections/ReminderFeesSection/ReminderFeesFields.js b/src/settings/FinePolicy/components/EditSections/ReminderFeesSection/ReminderFeesFields.js index 7519f405..40d89982 100644 --- a/src/settings/FinePolicy/components/EditSections/ReminderFeesSection/ReminderFeesFields.js +++ b/src/settings/FinePolicy/components/EditSections/ReminderFeesSection/ReminderFeesFields.js @@ -21,11 +21,11 @@ import { timeUnits, noticeMethods } from '../../../../../constants'; const ReminderFeesFields = props => { const { formatMessage } = useIntl(); const { - canAdd, - canEdit, - canDelete, - noticeTemplates, - blockTemplates, + canAdd = true, + canEdit = true, + canDelete = true, + noticeTemplates = [], + blockTemplates = [], } = props; const sequenceLabel = formatMessage({ id: 'ui-circulation.settings.finePolicy.reminderFees.sequence' }); const intervalLabel = formatMessage({ id: 'ui-circulation.settings.finePolicy.reminderFees.interval' }); @@ -194,12 +194,4 @@ ReminderFeesFields.propTypes = { blockTemplates: PropTypes.arrayOf(PropTypes.object), }; -ReminderFeesFields.defaultProps = { - canAdd: true, - canEdit: true, - canDelete: true, - noticeTemplates: [], - blockTemplates: [], -}; - export default ReminderFeesFields; diff --git a/src/settings/NoticePolicy/components/DetailSections/GeneralSection/GeneralSection.js b/src/settings/NoticePolicy/components/DetailSections/GeneralSection/GeneralSection.js index 75c2125f..4de09212 100644 --- a/src/settings/NoticePolicy/components/DetailSections/GeneralSection/GeneralSection.js +++ b/src/settings/NoticePolicy/components/DetailSections/GeneralSection/GeneralSection.js @@ -16,8 +16,8 @@ const GeneralSection = (props) => { connect, metadata, policyName, - isPolicyActive, - policyDescription, + isPolicyActive = false, + policyDescription = '', } = props; const active = isPolicyActive @@ -81,9 +81,4 @@ GeneralSection.propTypes = { connect: PropTypes.func.isRequired, }; -GeneralSection.defaultProps = { - policyDescription: '', - isPolicyActive: false, -}; - export default GeneralSection; diff --git a/src/settings/PatronNotices/PatronNoticeForm.js b/src/settings/PatronNotices/PatronNoticeForm.js index 325aaa83..e6cd28ff 100644 --- a/src/settings/PatronNotices/PatronNoticeForm.js +++ b/src/settings/PatronNotices/PatronNoticeForm.js @@ -39,10 +39,10 @@ import css from './PatronNoticeForm.css'; const PatronNoticeForm = (props) => { const { handleSubmit, - initialValues, + initialValues = {}, initialValues: { id: initialId, - }, + } = {}, location: { search, }, @@ -88,8 +88,8 @@ const PatronNoticeForm = (props) => { initialValues: notice, } = props; - return notice.id - ? notice.name + return notice?.id + ? notice?.name : formatMessage({ id: 'ui-circulation.settings.patronNotices.newLabel' }); }; @@ -190,9 +190,6 @@ PatronNoticeForm.propTypes = { stripes: stripesShape.isRequired, }; -PatronNoticeForm.defaultProps = { - initialValues: {}, -}; export default stripesFinalForm({ navigationCheck: true, validate: validatePatronNoticeTemplate, diff --git a/src/settings/StaffSlips/StaffSlipForm.js b/src/settings/StaffSlips/StaffSlipForm.js index f7d9cff5..c2944cca 100644 --- a/src/settings/StaffSlips/StaffSlipForm.js +++ b/src/settings/StaffSlips/StaffSlipForm.js @@ -31,7 +31,7 @@ const StaffSlipForm = (props) => { const { stripes, handleSubmit, - initialValues, + initialValues = {}, pristine, submitting, onCancel, @@ -118,10 +118,6 @@ StaffSlipForm.propTypes = { intl: PropTypes.object.isRequired, }; -StaffSlipForm.defaultProps = { - initialValues: {}, -}; - export default stripesFinalForm({ navigationCheck: true, })(injectIntl(StaffSlipForm)); diff --git a/src/settings/components/CancelButton/CancelButton.js b/src/settings/components/CancelButton/CancelButton.js index a6e0cd44..5b34e37b 100644 --- a/src/settings/components/CancelButton/CancelButton.js +++ b/src/settings/components/CancelButton/CancelButton.js @@ -9,7 +9,7 @@ import { const CancelButton = ({ onCancel, - labelKey, + labelKey = 'ui-circulation.settings.common.closeEntryDialog', }) => ( @@ -32,8 +32,4 @@ CancelButton.propTypes = { labelKey: PropTypes.string, }; -CancelButton.defaultProps = { - labelKey: 'ui-circulation.settings.common.closeEntryDialog', -}; - export default CancelButton; diff --git a/src/settings/components/FooterPane/FooterPane.js b/src/settings/components/FooterPane/FooterPane.js index 2faa014b..4f8d0300 100644 --- a/src/settings/components/FooterPane/FooterPane.js +++ b/src/settings/components/FooterPane/FooterPane.js @@ -12,7 +12,7 @@ import css from './FooterPane.css'; const FooterPane = (props) => { const { isSaveButtonDisabled, - isSaveButtonAvailable, + isSaveButtonAvailable = true, onCancel, } = props; @@ -49,8 +49,4 @@ FooterPane.propTypes = { onCancel: PropTypes.func.isRequired, }; -FooterPane.defaultProps = { - isSaveButtonAvailable: true, -}; - export default FooterPane;