Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UICIRC-1080: React v19: refactor away from default props for function… #1185

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand Down Expand Up @@ -194,12 +194,4 @@ ReminderFeesFields.propTypes = {
blockTemplates: PropTypes.arrayOf(PropTypes.object),
};

ReminderFeesFields.defaultProps = {
canAdd: true,
canEdit: true,
canDelete: true,
noticeTemplates: [],
blockTemplates: [],
};

export default ReminderFeesFields;
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const GeneralSection = (props) => {
connect,
metadata,
policyName,
isPolicyActive,
policyDescription,
isPolicyActive = false,
policyDescription = '',
} = props;

const active = isPolicyActive
Expand Down Expand Up @@ -81,9 +81,4 @@ GeneralSection.propTypes = {
connect: PropTypes.func.isRequired,
};

GeneralSection.defaultProps = {
policyDescription: '',
isPolicyActive: false,
};

export default GeneralSection;
11 changes: 4 additions & 7 deletions src/settings/PatronNotices/PatronNoticeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ import css from './PatronNoticeForm.css';
const PatronNoticeForm = (props) => {
const {
handleSubmit,
initialValues,
initialValues = {},
initialValues: {
id: initialId,
},
} = {},
location: {
search,
},
Expand Down Expand Up @@ -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' });
};

Expand Down Expand Up @@ -190,9 +190,6 @@ PatronNoticeForm.propTypes = {
stripes: stripesShape.isRequired,
};

PatronNoticeForm.defaultProps = {
initialValues: {},
};
export default stripesFinalForm({
navigationCheck: true,
validate: validatePatronNoticeTemplate,
Expand Down
6 changes: 1 addition & 5 deletions src/settings/StaffSlips/StaffSlipForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const StaffSlipForm = (props) => {
const {
stripes,
handleSubmit,
initialValues,
initialValues = {},
pristine,
submitting,
onCancel,
Expand Down Expand Up @@ -118,10 +118,6 @@ StaffSlipForm.propTypes = {
intl: PropTypes.object.isRequired,
};

StaffSlipForm.defaultProps = {
initialValues: {},
};

export default stripesFinalForm({
navigationCheck: true,
})(injectIntl(StaffSlipForm));
6 changes: 1 addition & 5 deletions src/settings/components/CancelButton/CancelButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {

const CancelButton = ({
onCancel,
labelKey,
labelKey = 'ui-circulation.settings.common.closeEntryDialog',
}) => (
<PaneMenu data-test-cancel-pane-menu>
<FormattedMessage id={labelKey}>
Expand All @@ -32,8 +32,4 @@ CancelButton.propTypes = {
labelKey: PropTypes.string,
};

CancelButton.defaultProps = {
labelKey: 'ui-circulation.settings.common.closeEntryDialog',
};

export default CancelButton;
6 changes: 1 addition & 5 deletions src/settings/components/FooterPane/FooterPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import css from './FooterPane.css';
const FooterPane = (props) => {
const {
isSaveButtonDisabled,
isSaveButtonAvailable,
isSaveButtonAvailable = true,
onCancel,
} = props;

Expand Down Expand Up @@ -49,8 +49,4 @@ FooterPane.propTypes = {
onCancel: PropTypes.func.isRequired,
};

FooterPane.defaultProps = {
isSaveButtonAvailable: true,
};

export default FooterPane;
Loading