diff --git a/CHANGELOG.md b/CHANGELOG.md index 3936ad79..e1bb95da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,9 @@ ## In progress -## [2.0.0](https://github.com/folio-org/ui-bulk-edit/tree/v2.0.1) (2022-07-22) +* [UIBULKED-130](https://issues.folio.org/browse/UIBULKED-130) Progress bar blinks (reloads) on the first run + +## [2.0.1](https://github.com/folio-org/ui-bulk-edit/tree/v2.0.1) (2022-07-22) * [UIBULKED-121](https://issues.folio.org/browse/UIBULKED-121) Duplicate request to /bulk-edit/{UUID}/start * [UIBULKED-111](https://issues.folio.org/browse/UIBULKED-111) Added row's action by default should be "Select action" diff --git a/src/API/useProgressStatus.js b/src/API/useProgressStatus.js index fccb0519..bcc43dc6 100644 --- a/src/API/useProgressStatus.js +++ b/src/API/useProgressStatus.js @@ -26,7 +26,7 @@ export const useProgressStatus = (id, typeOfProgress) => { }); }; - const { data } = useQuery({ + const { data, remove } = useQuery({ queryKey: ['progress', id], queryFn: () => ky.get(`data-export-spring/jobs/${id}`).json(), enabled: !!id, @@ -51,5 +51,6 @@ export const useProgressStatus = (id, typeOfProgress) => { return { data, + remove, }; }; diff --git a/src/components/ProgressBar/ProgressBar.css b/src/components/ProgressBar/ProgressBar.css index 240f11f7..8358d8e3 100644 --- a/src/components/ProgressBar/ProgressBar.css +++ b/src/components/ProgressBar/ProgressBar.css @@ -33,7 +33,6 @@ .progressBarLine div { border-radius: 15px; background-color: var( --primary); - width: 60%; height: 100%; transition: width .2s linear; } diff --git a/src/components/ProgressBar/ProgressBar.js b/src/components/ProgressBar/ProgressBar.js index 2b865ace..f0d44d6e 100644 --- a/src/components/ProgressBar/ProgressBar.js +++ b/src/components/ProgressBar/ProgressBar.js @@ -10,19 +10,21 @@ import { useProgressStatus } from '../../API/useProgressStatus'; export const ProgressBar = ({ updatedId, typeOfProgress }) => { const location = useLocation(); const history = useHistory(); - const { data } = useProgressStatus(updatedId, typeOfProgress); + const { data, remove } = useProgressStatus(updatedId, typeOfProgress); const processedTitle = new URLSearchParams(location.search).get('processedFileName'); const title = new URLSearchParams(location.search).get('fileName'); useEffect(() => { if (!processedTitle && location.pathname.includes('processed')) { + remove(); history.replace({ pathname: location.pathname, search: buildSearch({ isCompleted: true }, location.search), }); } - }, [history, location.pathname, location.search, processedTitle]); + }, [location.pathname, location.search, processedTitle]); + const progressValue = data?.progress?.progress || 1; return (