diff --git a/doc/release/RELEASE-NOTES.md b/doc/release/RELEASE-NOTES.md index 8e77253e0..5a1fa145e 100644 --- a/doc/release/RELEASE-NOTES.md +++ b/doc/release/RELEASE-NOTES.md @@ -65,6 +65,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html ### Bugfix * Ensure that the OpenSearch domain name is unique for each environment to avoid conflicts when provisioning domains across different environments. * [OSDEV-1176](https://opensupplyhub.atlassian.net/browse/OSDEV-1176) - Fixed a spelling mistake in the label for the password field on the LogIn page. After the fix, the label reads "Password". +* [OSDEV-1178](https://opensupplyhub.atlassian.net/browse/OSDEV-1178) - Fixed error "Something went wrong" error after clicking on Dashboard -> View Facility Claims. ### What's new * [OSDEV-1144](https://opensupplyhub.atlassian.net/browse/OSDEV-1144) - Claims emails. Updated text for approval, revocation, and denial emails. diff --git a/src/react/src/components/DashboardClaimsListTable.jsx b/src/react/src/components/DashboardClaimsListTable.jsx index 2a9ecb6ee..41a85b162 100644 --- a/src/react/src/components/DashboardClaimsListTable.jsx +++ b/src/react/src/components/DashboardClaimsListTable.jsx @@ -102,6 +102,9 @@ function DashboardClaimsListTable({ handleSortClaims(sortedData); }; + const wasNotEmptyAndNowEmpty = (prev, current) => + prev?.current?.length > 0 && current?.length === 0; + useEffect(() => { /* Fetch data if prev filters were not empty but @@ -109,24 +112,21 @@ function DashboardClaimsListTable({ This will resolve conflict of when we want to fetch data when claims or countries filters are removing in UI at the moment */ - const wasNotEmptyAndNowEmptyClaimStatuses = - prevClaimStatuses && - prevClaimStatuses.current && - prevClaimStatuses.current.length > 0 && - claimStatuses.length === 0; - - const wasNotEmptyAndNowEmptyCountriesData = - prevCountriesData && - prevCountriesData.current && - prevCountriesData.current.length > 0 && - countriesData.length === 0; + const wasNotEmptyAndNowEmptyClaimStatuses = wasNotEmptyAndNowEmpty( + prevClaimStatuses, + claimStatuses, + ); + const wasNotEmptyAndNowEmptyCountriesData = wasNotEmptyAndNowEmpty( + prevCountriesData, + countriesData, + ); if (isFirstRender.current) { isFirstRender.current = false; } else if ( - claimStatuses.length > 0 || + claimStatuses?.length > 0 || wasNotEmptyAndNowEmptyClaimStatuses || - countriesData.length > 0 || + countriesData?.length > 0 || wasNotEmptyAndNowEmptyCountriesData ) { handleGetClaims();