diff --git a/CHANGELOG.md b/CHANGELOG.md index b004d5c4..f2816687 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 9.1.0 (IN PROGRESS) * Fix bug in JobView test ([UIEUS-360](https://folio-org.atlassian.net/browse/UIEUS-360)) +* React v19: refactor away from default props for functional components ([UIEUS-355](https://folio-org.atlassian.net/browse/UIEUS-355)) ## [9.0.0](https://github.com/folio-org/ui-erm-usage/tree/v9.0.0) (2024-04-17) * *BREAKING* Use `multipart/form-data` to upload COUNTER reports ([UIEUS-353](https://folio-org.atlassian.net/browse/UIEUS-353)) diff --git a/src/components/JobsView/JobsViewResultCell.js b/src/components/JobsView/JobsViewResultCell.js index c68e71fb..e324ffe7 100644 --- a/src/components/JobsView/JobsViewResultCell.js +++ b/src/components/JobsView/JobsViewResultCell.js @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import { memo } from 'react'; import styles from './JobsView.css'; -const JobsViewResultCell = ({ errorMessage, text }) => { +const JobsViewResultCell = ({ errorMessage = '', text }) => { const textWithInfo = ( {text} @@ -19,8 +19,4 @@ JobsViewResultCell.propTypes = { text: PropTypes.string.isRequired }; -JobsViewResultCell.defaultProps = { - errorMessage: '' -}; - export default memo(JobsViewResultCell); diff --git a/src/components/UDPHeader/UDPHeader.js b/src/components/UDPHeader/UDPHeader.js index 2c811667..373d7178 100644 --- a/src/components/UDPHeader/UDPHeader.js +++ b/src/components/UDPHeader/UDPHeader.js @@ -6,7 +6,7 @@ import { useStripes } from '@folio/stripes/core'; import harvestingStatusOptions from '../../util/data/harvestingStatusOptions'; import css from './UDPHeader.css'; -const UDPHeader = ({ usageDataProvider, lastJob }) => { +const UDPHeader = ({ usageDataProvider = { harvestingConfig: {} }, lastJob = {} }) => { const stripes = useStripes(); const { latestReport, @@ -60,13 +60,6 @@ const UDPHeader = ({ usageDataProvider, lastJob }) => { ); }; -UDPHeader.defaultProps = { - usageDataProvider: { - harvestingConfig: {}, - }, - lastJob: {}, -}; - UDPHeader.propTypes = { usageDataProvider: PropTypes.shape({ latestReport: PropTypes.string, diff --git a/src/routes/UDPViewRoute.js b/src/routes/UDPViewRoute.js index 0bdbb73e..10197eda 100644 --- a/src/routes/UDPViewRoute.js +++ b/src/routes/UDPViewRoute.js @@ -14,7 +14,7 @@ import { MAX_FAILED_ATTEMPTS } from '../util/constants'; function UDPViewRoute(props) { const { - handlers, + handlers = {}, mutator, resources, stripes, @@ -185,10 +185,6 @@ UDPViewRoute.propTypes = { tagsEnabled: PropTypes.bool, }; -UDPViewRoute.defaultProps = { - handlers: {}, -}; - UDPViewRoute.manifest = Object.freeze({ usageDataProvider: { type: 'okapi', diff --git a/src/routes/components/withReportHandlers.js b/src/routes/components/withReportHandlers.js index d11f9527..117abce0 100644 --- a/src/routes/components/withReportHandlers.js +++ b/src/routes/components/withReportHandlers.js @@ -124,7 +124,7 @@ export default function withReportHandlers(WrappedComponent) { }); }; - const { handlers, ...rest } = props; + const { handlers = {}, ...rest } = props; return ( <> @@ -155,9 +155,5 @@ export default function withReportHandlers(WrappedComponent) { intl: PropTypes.object, }; - WithReportHandlers.defaultProps = { - handlers: {}, - }; - return withStripes(injectIntl(WithReportHandlers)); }