diff --git a/CHANGELOG.md b/CHANGELOG.md index 4255e2c79..14decad44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Fix issue with `Proxy borrower` field value. Refs UIU-3290. * Remove duplicates from the keyboard shortcut modal. Refs UIU-3026. * Add sub permission `manual-block-templates.collection.get` to permission `Users: Can create, edit and remove patron blocks`. Refs UIU-3305. +* React v19: refactor away from default props for functional components. Refs. UIU-3141. ## [11.0.9](https://github.com/folio-org/ui-users/tree/v11.0.9) (2024-12-13) [Full Changelog](https://github.com/folio-org/ui-users/compare/v11.0.8...v11.0.9) diff --git a/src/components/AffiliationsManager/AffiliationsManager.js b/src/components/AffiliationsManager/AffiliationsManager.js index 257609f4a..b0bb0368d 100644 --- a/src/components/AffiliationsManager/AffiliationsManager.js +++ b/src/components/AffiliationsManager/AffiliationsManager.js @@ -5,11 +5,11 @@ import { AffiliationsManagerModal } from './AffiliationsManagerModal'; import AffiliationsManagerTrigger from './AffiliationsManagerTrigger'; const AffiliationsManager = ({ - disabled, + disabled = false, onUpdateAffiliations, - renderTrigger, + renderTrigger = AffiliationsManagerTrigger, userId, - withTrigger, + withTrigger = true, }) => { const [isModalOpen, toggleModal] = useToggle(!withTrigger); @@ -36,10 +36,4 @@ AffiliationsManager.propTypes = { withTrigger: PropTypes.bool, }; -AffiliationsManager.defaultProps = { - disabled: false, - renderTrigger: AffiliationsManagerTrigger, - withTrigger: true, -}; - export default AffiliationsManager; diff --git a/src/components/AffiliationsSelect/AffiliationsSelect.js b/src/components/AffiliationsSelect/AffiliationsSelect.js index 18faab0b1..6dcde943f 100644 --- a/src/components/AffiliationsSelect/AffiliationsSelect.js +++ b/src/components/AffiliationsSelect/AffiliationsSelect.js @@ -13,7 +13,7 @@ import { Selection } from '@folio/stripes/components'; import { affiliationsShape } from '../../shapes'; const AffiliationsSelect = ({ - id, + id = 'user-assigned', affiliations, value, onChange, @@ -53,10 +53,6 @@ const AffiliationsSelect = ({ ); }; -AffiliationsSelect.defaultProps = { - id: 'user-assigned', -}; - AffiliationsSelect.propTypes = { affiliations: affiliationsShape, onChange: PropTypes.func.isRequired, diff --git a/src/components/AssignedUsers/AssignedUsersContainer.js b/src/components/AssignedUsers/AssignedUsersContainer.js index 996a33385..54da168b6 100644 --- a/src/components/AssignedUsers/AssignedUsersContainer.js +++ b/src/components/AssignedUsers/AssignedUsersContainer.js @@ -24,7 +24,12 @@ import AssignUsers from './AssignUsers'; import AssignedUsersList from './AssignedUsersList'; import { getUpdatedUsersList } from './utils'; -const AssignedUsersContainer = ({ permissionSetId, expanded, onToggle, tenantId }) => { +const AssignedUsersContainer = ({ + permissionSetId, + expanded = true, + onToggle, + tenantId +}) => { const callout = useCallout(); const intl = useIntl(); @@ -123,8 +128,4 @@ AssignedUsersContainer.propTypes = { tenantId: PropTypes.string, }; -AssignedUsersContainer.defaultProps = { - expanded: true, -}; - export default AssignedUsersContainer; diff --git a/src/components/AssignedUsers/AssignedUsersList.js b/src/components/AssignedUsers/AssignedUsersList.js index b4c7234a3..7e3b14d8f 100644 --- a/src/components/AssignedUsers/AssignedUsersList.js +++ b/src/components/AssignedUsers/AssignedUsersList.js @@ -12,7 +12,7 @@ import { VISIBLE_COLUMNS, } from './constants'; -const AssignedUsersList = ({ users, isFetching }) => ( +const AssignedUsersList = ({ users = [], isFetching = false }) => ( { const { failedRenewals, successRenewals, - height, + height = 300, errorMessages, requestCounts, loanPolicies, @@ -126,7 +122,6 @@ const BulkRenewedLoansList = (props) => { ); }; -BulkRenewedLoansList.defaultProps = defaultProps; BulkRenewedLoansList.propTypes = propTypes; export default BulkRenewedLoansList; diff --git a/src/components/EditSections/EditUserInfo/components/ChangeUserTypeModal/ChangeUserTypeModal.js b/src/components/EditSections/EditUserInfo/components/ChangeUserTypeModal/ChangeUserTypeModal.js index dece42bc5..863d4e517 100644 --- a/src/components/EditSections/EditUserInfo/components/ChangeUserTypeModal/ChangeUserTypeModal.js +++ b/src/components/EditSections/EditUserInfo/components/ChangeUserTypeModal/ChangeUserTypeModal.js @@ -9,7 +9,7 @@ import { import { USER_TYPES } from '../../../../../constants'; -const ChangeUserTypeModal = ({ onChange, initialUserType, open }) => { +const ChangeUserTypeModal = ({ onChange, initialUserType, open = false }) => { const userTypeModalFooter = (