diff --git a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/BulkEditInApp.js b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/BulkEditInApp.js index f31b2395..29da98ac 100644 --- a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/BulkEditInApp.js +++ b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/BulkEditInApp.js @@ -57,12 +57,13 @@ export const BulkEditInApp = ({ const isHoldingsRecordType = currentRecordType === CAPABILITIES.HOLDING; const isInstanceRecordType = currentRecordType === CAPABILITIES.INSTANCE; + const { data: tenants, isLoading } = useBulkOperationTenants(bulkOperationId); + console.log(tenants) const { itemNotes, isItemNotesLoading } = useItemNotes({ enabled: isItemRecordType }); const { holdingsNotes, isHoldingsNotesLoading } = useHoldingsNotes({ enabled: isHoldingsRecordType }); const { instanceNotes, isInstanceNotesLoading } = useInstanceNotes({ enabled: isInstanceRecordType }); - const { data: tenants } = useBulkOperationTenants(bulkOperationId); - const { notesEsc: itemNotesEsc, isFetching: isItemsNotesEscLoading } = useItemNotesEsc(tenants, 'option', { enabled: isItemRecordType && isCentralTenant }); - const { notesEsc: holdingsNotesEsc, isFetching: isHoldingsNotesEscLoading } = useHoldingsNotesEsc(tenants, 'option', { enabled: isHoldingsRecordType && isCentralTenant }); + const { notesEsc: itemNotesEsc, isFetching: isItemsNotesEscLoading } = useItemNotesEsc(tenants, 'option', { enabled: isItemRecordType && isCentralTenant && !isLoading }); + const { notesEsc: holdingsNotesEsc, isFetching: isHoldingsNotesEscLoading } = useHoldingsNotesEsc(tenants, 'option', { enabled: isHoldingsRecordType && isCentralTenant && !isLoading }); const options = useMemo(() => ({ [CAPABILITIES.ITEM]: getItemsOptions(formatMessage, removeDuplicatesByValue(isCentralTenant ? itemNotesEsc : itemNotes, tenants)), diff --git a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ValuesColumn.js b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ValuesColumn.js index 2be55c0d..e93167ff 100644 --- a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ValuesColumn.js +++ b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ValuesColumn.js @@ -70,7 +70,7 @@ export const ValuesColumn = ({ action, allActions, actionIndex, onChange, option currentRecordType, } = useSearchParams(); const { id: bulkOperationId } = usePathParams('/bulk-edit/:id'); - const isCentralTenant = checkIfUserInCentralTenant(stripes); + const isCentralTenant = checkIfUserInCentralTenant(stripes) const isUserCapability = currentRecordType === CAPABILITIES.USER; const isItemCapability = currentRecordType === CAPABILITIES.ITEM; diff --git a/src/hooks/api/useBulkOperationTenants.js b/src/hooks/api/useBulkOperationTenants.js index e15b7a39..25068fa6 100644 --- a/src/hooks/api/useBulkOperationTenants.js +++ b/src/hooks/api/useBulkOperationTenants.js @@ -12,6 +12,7 @@ export const useBulkOperationTenants = (id, options = {}) => { queryKey: [namespace], queryFn: () => ky.get(`bulk-operations/used-tenants/${id}`).json(), keepPreviousData: true, + enabled: !!id, ...options, });