diff --git a/doc/release/RELEASE-NOTES.md b/doc/release/RELEASE-NOTES.md index 8d0283c06..f66003075 100644 --- a/doc/release/RELEASE-NOTES.md +++ b/doc/release/RELEASE-NOTES.md @@ -67,6 +67,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html * [OSDEV-1695](https://opensupplyhub.atlassian.net/browse/OSDEV-1695) - [SLC] Enabled the claim button for updated production locations when a moderation event has a pending status. Disabled claim button explicitly if production location has pending claim status. * [OSDEV-1701](https://opensupplyhub.atlassian.net/browse/OSDEV-1701) - Refactored "Go Back" button in production location info page. * [OSDEV-1672](https://opensupplyhub.atlassian.net/browse/OSDEV-1672) - SLC. Implement collecting contribution data page (FE) - All Multi-Selects on the page have been fixed. They resize based on the number of items selected. +* [OSDEV-1696](https://opensupplyhub.atlassian.net/browse/OSDEV-1696) - Added loader on single production location fetch; added error handling; added cleanup hook to clear production location data on component unmount. * [OSDEV-1653](https://opensupplyhub.atlassian.net/browse/OSDEV-1653) - Added asterisks next to each required form field (Name, Address, and Country) on the "Search by Name and Address" tab. Highlighted an empty field and displayed an error message if it loses focus. Added proper styles for the error messages. * [OSDEV-1589](https://opensupplyhub.atlassian.net/browse/OSDEV-1589) - Fixed layout issue on new `contribute` page. diff --git a/src/react/src/components/Contribute/ProductionLocationInfo.jsx b/src/react/src/components/Contribute/ProductionLocationInfo.jsx index 7e4d02703..6bf3e6773 100644 --- a/src/react/src/components/Contribute/ProductionLocationInfo.jsx +++ b/src/react/src/components/Contribute/ProductionLocationInfo.jsx @@ -12,6 +12,7 @@ import IconButton from '@material-ui/core/IconButton'; import Typography from '@material-ui/core/Typography'; import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown'; import ArrowDropUpIcon from '@material-ui/icons/ArrowDropUp'; +import CircularProgress from '@material-ui/core/CircularProgress'; import StyledSelect from '../Filters/StyledSelect'; import { productionLocationInfoStyles } from '../../util/styles'; import { @@ -29,6 +30,7 @@ import { updateProductionLocation, fetchProductionLocationByOsId, resetPendingModerationEvent, + resetSingleProductionLocation, } from '../../actions/contributeProductionLocation'; import { fetchSingleModerationEvent, @@ -69,9 +71,12 @@ const ProductionLocationInfo = ({ singleModerationEventItemError, fetchProductionLocation, singleProductionLocationData, + singleProductionLocationFetching, + singleProductionLocationError, innerWidth, handleCleanupContributionRecord, handleResetPendingModerationEvent, + handleResetSingleProductionLocation, }) => { const location = useLocation(); const history = useHistory(); @@ -362,6 +367,14 @@ const ProductionLocationInfo = ({ moderationID, ]); + useEffect(() => { + if (!isEmpty(singleProductionLocationError)) { + toast(singleProductionLocationError[0]); + } + }, [singleProductionLocationError]); + + useEffect(() => () => handleResetSingleProductionLocation(), []); + return ( <>