diff --git a/CHANGELOG.md b/CHANGELOG.md index 31a70cff..0c850f9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * [UIPQB-126](https://folio-org.atlassian.net/browse/UIPQB-126) Use tenant timezone for building queries (adds use of permission `configuration.entries.collection.get`). * [UIBULKED-582](https://folio-org.atlassian.net/browse/UIBULKED-582) Temporarily remove error handling from publish-coordinator related logic. * [UIBULKED-581](https://folio-org.atlassian.net/browse/UIBULKED-581) "Something went wrong" error notification displays +* [UIBULKED-583](https://folio-org.atlassian.net/browse/UIBULKED-583) Include tenants array into request if there is "final" action selected. ## [4.2.0](https://github.com/folio-org/ui-bulk-edit/tree/v4.2.0) (2024-10-31) diff --git a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ContentUpdatesForm.js b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ContentUpdatesForm.js index c0a9be80..6adadd84 100644 --- a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ContentUpdatesForm.js +++ b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ContentUpdatesForm.js @@ -15,6 +15,7 @@ import { import { ACTIONS, + FINAL_ACTIONS, OPTIONS } from '../../../../../constants'; import css from '../../../BulkEditPane.css'; @@ -224,8 +225,10 @@ export const ContentUpdatesForm = ({ const actionParameters = actions.find(action => Boolean(action?.parameters))?.parameters; const filteredTenants = actionTenants.filter(Boolean); + // final action is the action which doesn't require any additional data after it + const isSecondActionFinal = FINAL_ACTIONS.includes(actions[1]?.name); - const activeTenants = filteredTenants.length === 1 + const activeTenants = isSecondActionFinal || filteredTenants.length === 1 ? filteredTenants.flat() : filteredTenants .flat() diff --git a/src/components/BulkEditPane/BulkEditListResult/BulkEditInAppPreviewModal/BulkEditPreviewModal.js b/src/components/BulkEditPane/BulkEditListResult/BulkEditInAppPreviewModal/BulkEditPreviewModal.js index c571eee0..edac216f 100644 --- a/src/components/BulkEditPane/BulkEditListResult/BulkEditInAppPreviewModal/BulkEditPreviewModal.js +++ b/src/components/BulkEditPane/BulkEditListResult/BulkEditInAppPreviewModal/BulkEditPreviewModal.js @@ -1,6 +1,7 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; import { useHistory } from 'react-router-dom'; +import { useQueryClient } from 'react-query'; import PropTypes from 'prop-types'; import { Modal } from '@folio/stripes/components'; @@ -13,7 +14,7 @@ import { FILE_KEYS, JOB_STATUSES, } from '../../../../constants'; -import { useBulkOperationStart } from '../../../../hooks/api'; +import { BULK_OPERATION_DETAILS_KEY, useBulkOperationStart } from '../../../../hooks/api'; import { BulkEditPreviewModalFooter } from './BulkEditPreviewModalFooter'; import { useSearchParams } from '../../../../hooks'; import { BulkEditPreviewModalList } from './BulkEditPreviewModalList'; @@ -32,6 +33,7 @@ export const BulkEditPreviewModal = ({ const { criteria, approach } = useSearchParams(); const { showErrorMessage } = useErrorMessages(); const { bulkOperationStart } = useBulkOperationStart(); + const queryClient = useQueryClient(); const hasLinkForDownload = bulkDetails?.[FILE_KEYS.PROPOSED_CHANGES_LINK_MARC] || bulkDetails?.[FILE_KEYS.PROPOSED_CHANGES_LINK]; @@ -47,6 +49,8 @@ export const BulkEditPreviewModal = ({ step: EDITING_STEPS.COMMIT, }); + queryClient.resetQueries(BULK_OPERATION_DETAILS_KEY); + onChangesCommited(); history.replace({ diff --git a/src/hooks/useConfirmChanges.js b/src/hooks/useConfirmChanges.js index a989658b..ef3b2325 100644 --- a/src/hooks/useConfirmChanges.js +++ b/src/hooks/useConfirmChanges.js @@ -45,7 +45,6 @@ export const useConfirmChanges = ({ const closePreviewModal = () => { setIsPreviewModalOpened(false); - queryClient.resetQueries(BULK_OPERATION_DETAILS_KEY); }; const confirmChanges = (payload) => {