@zeniai/client-epic-state 5.0.71-betaML41 → 5.0.71-betaVR2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/lib/epic.d.ts +3 -2
  2. package/lib/epic.js +3 -2
  3. package/lib/esm/epic.js +3 -2
  4. package/lib/esm/index.js +8 -8
  5. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +21 -5
  6. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/refreshBatchDetailsForBatchIdEpic.js +52 -0
  7. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/syncTabsAfterAutomatchEpic.js +53 -0
  8. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +13 -9
  9. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +1 -21
  10. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +78 -3
  11. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +14 -117
  12. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +2 -0
  13. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +0 -58
  14. package/lib/esm/view/recommendation/recommendationHelper.js +0 -29
  15. package/lib/esm/view/recommendation/recommendationReducer.js +1 -26
  16. package/lib/esm/view/transactionDetail/transactionDetailReducer.js +6 -121
  17. package/lib/esm/view/transactionDetail/transactionDetailSelector.js +0 -22
  18. package/lib/index.d.ts +8 -9
  19. package/lib/index.js +25 -25
  20. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +21 -5
  21. package/lib/view/expenseAutomationView/epics/missingReceipts/refreshBatchDetailsForBatchIdEpic.d.ts +18 -0
  22. package/lib/view/expenseAutomationView/epics/missingReceipts/refreshBatchDetailsForBatchIdEpic.js +56 -0
  23. package/lib/view/expenseAutomationView/epics/missingReceipts/syncTabsAfterAutomatchEpic.d.ts +28 -0
  24. package/lib/view/expenseAutomationView/epics/missingReceipts/syncTabsAfterAutomatchEpic.js +57 -0
  25. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +11 -5
  26. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +12 -8
  27. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +0 -1
  28. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -23
  29. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +13 -1
  30. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +80 -4
  31. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -14
  32. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +14 -117
  33. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +12 -0
  34. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -2
  35. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +2 -0
  36. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +0 -3
  37. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +0 -60
  38. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +19 -0
  39. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +0 -1
  40. package/lib/view/recommendation/recommendationHelper.d.ts +0 -9
  41. package/lib/view/recommendation/recommendationHelper.js +1 -31
  42. package/lib/view/recommendation/recommendationReducer.d.ts +1 -20
  43. package/lib/view/recommendation/recommendationReducer.js +2 -27
  44. package/lib/view/transactionDetail/transactionDetailReducer.d.ts +1 -11
  45. package/lib/view/transactionDetail/transactionDetailReducer.js +7 -122
  46. package/lib/view/transactionDetail/transactionDetailSelector.d.ts +0 -2
  47. package/lib/view/transactionDetail/transactionDetailSelector.js +1 -24
  48. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -1
  49. package/package.json +2 -2
  50. package/lib/esm/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +0 -87
  51. package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.d.ts +0 -9
  52. package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +0 -91
@@ -31,10 +31,19 @@ export function fetchBatchDetailsByIds(batchIds, zeniAPI) {
31
31
  }
32
32
  export const fetchMultipleBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchBulkUploadBatchesSuccess.match), mergeMap((action) => {
33
33
  const batchList = action.payload.batchList;
34
- const { batchDetailsById } = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
34
+ const bulkUpload = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
35
+ const { batchDetailsById, batchDetailsRevalidating } = bulkUpload;
35
36
  /** Only completed list rows may trigger batch-details API; preserve platform order. */
36
- const completedBatchesMissingDetails = filterBatchListItemsForBatchDetailsFetch(batchList).filter((batch) => batchDetailsById[batch.batchId] == null);
37
- const completedBatchIds = completedBatchesMissingDetails.map((batch) => batch.batchId);
37
+ const completedRows = filterBatchListItemsForBatchDetailsFetch(batchList);
38
+ /**
39
+ * Stale-while-revalidate: when a manual refresh has set `batchDetailsRevalidating`, refresh
40
+ * every completed list row (replacing entries via `storeBatchDetails` as they arrive). On a
41
+ * normal first fetch we still only request rows whose details are missing.
42
+ */
43
+ const candidateRows = batchDetailsRevalidating === true
44
+ ? completedRows
45
+ : completedRows.filter((batch) => batchDetailsById[batch.batchId] == null);
46
+ const completedBatchIds = candidateRows.map((batch) => batch.batchId);
38
47
  const batchIdsToFetch = completedBatchIds.slice(0, INITIAL_BATCH_PAGE_SIZE);
39
48
  if (batchIdsToFetch.length === 0) {
40
49
  /**
@@ -42,7 +51,6 @@ export const fetchMultipleBatchDetailsEpic = (actions$, state$, zeniAPI) => acti
42
51
  * `currentBatchId` may not appear in the filtered list but still needs `GET /batches/:id`.
43
52
  * Fall back to the single-batch-details epic so `phase` and details can resolve.
44
53
  */
45
- const bulkUpload = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
46
54
  const currentId = bulkUpload.currentBatchId;
47
55
  if (currentId != null &&
48
56
  bulkUpload.phase === 'matching' &&
@@ -50,7 +58,15 @@ export const fetchMultipleBatchDetailsEpic = (actions$, state$, zeniAPI) => acti
50
58
  shouldFetchBatchDetailsForBatchId(bulkUpload.batchStatusById, bulkUpload.batchListByPeriod, currentId)) {
51
59
  return of(fetchBulkUploadBatchDetails());
52
60
  }
53
- return EMPTY;
61
+ /**
62
+ * Close the pagination loop so the Unmatched-tab loading heuristic can settle.
63
+ * `fetchMoreBatchDetailsComplete` also clears `batchDetailsRevalidating` and flips
64
+ * `initialBatchDetailsLoaded` to true. Without this, `batchDetailsPaginationState` stays
65
+ * at `Not-Started` forever after a list refresh that finds zero completed rows (or all
66
+ * already cached) — the direct-open-Unmatched-without-upload path used to render an
67
+ * infinite skeleton.
68
+ */
69
+ return of(fetchMoreBatchDetailsComplete());
54
70
  }
55
71
  return concat(of(setInitialBatchDetailsLoading()), fetchBatchDetailsByIds(batchIdsToFetch, zeniAPI), of(fetchMoreBatchDetailsComplete()));
56
72
  }));
@@ -0,0 +1,52 @@
1
+ import { EMPTY, concat, from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
4
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
+ import { extractTransactionPayloadsFromBatchFiles, isBatchDetailsApiStatusCompleted, toBatchDetails, } from '../../payload/missingReceiptsPayload';
6
+ import { batchDetailFetchFailed, markBatchDetailRefreshAttempted, refreshBatchDetailsForBatchId, storeBatchDetails, } from '../../reducers/missingReceiptsViewReducer';
7
+ /**
8
+ * Pusher resends the same `completed` event in some cases (reconnect, server retry). Skip a
9
+ * targeted refresh if we issued one for the same batch within this window — the cached details
10
+ * are already fresh, so another `GET /1.0/batches/:id` is wasteful and visually flickers nothing.
11
+ */
12
+ const TARGETED_REFRESH_DEDUPE_MS = 5000;
13
+ /**
14
+ * Single-batch stale-while-revalidate refresh. Triggered by `pusherBatchStatusCompletionEpic`
15
+ * (and any other path that wants to update one batch without wiping the cache). The response is
16
+ * stored via `storeBatchDetails`, which replaces the entry by `batchId` so the row updates in
17
+ * place — no skeleton, no list reflow.
18
+ *
19
+ * Throttle: `lastBatchDetailRefreshAtById[batchId]` is checked against `TARGETED_REFRESH_DEDUPE_MS`
20
+ * before issuing the call. The marker is emitted first so concurrent dispatches (e.g. Pusher
21
+ * resend during an in-flight request) see the dedupe timestamp and collapse to a single call.
22
+ */
23
+ export const refreshBatchDetailsForBatchIdEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(refreshBatchDetailsForBatchId.match), mergeMap((action) => {
24
+ const { batchId } = action.payload;
25
+ const now = Date.now();
26
+ const lastAttempt = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload
27
+ .lastBatchDetailRefreshAtById[batchId];
28
+ if (lastAttempt != null &&
29
+ now - lastAttempt < TARGETED_REFRESH_DEDUPE_MS) {
30
+ return EMPTY;
31
+ }
32
+ const apiCall = zeniAPI
33
+ .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
34
+ .pipe(mergeMap((response) => {
35
+ if (!isSuccessResponse(response) ||
36
+ response.data == null ||
37
+ !isBatchDetailsApiStatusCompleted(response.data.status)) {
38
+ return EMPTY;
39
+ }
40
+ const actions = [];
41
+ const transactionPayloads = extractTransactionPayloadsFromBatchFiles(response.data.files);
42
+ if (transactionPayloads.length > 0) {
43
+ actions.push(updateTransactions(transactionPayloads, (value) => value.transaction_id));
44
+ }
45
+ actions.push(storeBatchDetails(toBatchDetails(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
46
+ return from(actions);
47
+ }), catchError((error) => {
48
+ console.error(`Failed to refresh batch details for ${batchId}:`, createZeniAPIStatus('Unexpected Error', 'Refresh batch details errored out: ' + JSON.stringify(error)));
49
+ return of(batchDetailFetchFailed({ batchId }));
50
+ }));
51
+ return concat(of(markBatchDetailRefreshAttempted({ batchId, timestamp: now })), apiCall);
52
+ }));
@@ -0,0 +1,53 @@
1
+ import { EMPTY, from, merge } from 'rxjs';
2
+ import { filter, switchMap, take, takeUntil } from 'rxjs/operators';
3
+ import { convertToPeriod, toAbsoluteDay, } from '../../../../commonStateTypes/timePeriod';
4
+ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
5
+ import { bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetailsSuccess, fetchCompletedTransactions, fetchMissingReceipts, restoreBulkUploadMatchingState, storeBatchDetails, } from '../../reducers/missingReceiptsViewReducer';
6
+ /**
7
+ * After automatch completes for the active bulk-upload batch, refresh the two
8
+ * caches that are not invalidated by the existing batch-details refresh path:
9
+ * - Missing Receipts list (`transactionIdsBySelectedPeriod`)
10
+ * - Completed transactions cache (`bulkUpload.completedTransactionsByPeriod`)
11
+ *
12
+ * The Unmatched tab is already kept fresh via `pusherBatchStatusCompletionEpic`
13
+ * dispatching `fetchBulkUploadBatches({invalidateBatchDetailsCache: true})`,
14
+ * which feeds `fetchMultipleBatchDetailsEpic` and re-stores batch details.
15
+ *
16
+ * Lifecycle mirrors `bulkUploadMatchResultToastEpic`: trigger on
17
+ * `bulkUploadReceiptsSuccess` (fresh upload) or `restoreBulkUploadMatchingState`
18
+ * (restored session), then wait for the first batch-details action for that
19
+ * batchId — landing as either `fetchBulkUploadBatchDetailsSuccess` or
20
+ * `storeBatchDetails`. `clearBulkUpload` cancels the in-flight wait.
21
+ *
22
+ * Refetches use `cacheOverride: true` to bypass per-tab cache guards, and
23
+ * `fetchMissingReceipts` uses `refreshViewInBackground: true` to keep the
24
+ * existing rows visible while fresh data is in flight (the authoritative
25
+ * server filter `is_attachment_missing_only=true` removes matched rows once
26
+ * the response lands).
27
+ */
28
+ export const syncTabsAfterAutomatchEpic = (actions$, state$) => actions$.pipe(filter((action) => bulkUploadReceiptsSuccess.match(action) ||
29
+ restoreBulkUploadMatchingState.match(action)), switchMap((uploadAction) => {
30
+ const { batchId } = uploadAction.payload;
31
+ return merge(actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match)), actions$.pipe(filter(storeBatchDetails.match))).pipe(filter((a) => a.payload.batchId === batchId), take(1), switchMap((action) => {
32
+ const { summary } = action.payload;
33
+ if (summary.matched <= 0) {
34
+ return EMPTY;
35
+ }
36
+ const state = state$.value;
37
+ const currentTenant = getCurrentTenant(state);
38
+ const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
39
+ if (selectedPeriod == null) {
40
+ return from([fetchCompletedTransactions(undefined, true)]);
41
+ }
42
+ const period = convertToPeriod(selectedPeriod);
43
+ const timePeriodStart = toAbsoluteDay(period.start);
44
+ const timePeriodEnd = toAbsoluteDay(period.end);
45
+ if (timePeriodStart == null || timePeriodEnd == null) {
46
+ return from([fetchCompletedTransactions(undefined, true)]);
47
+ }
48
+ return from([
49
+ fetchMissingReceipts({ start: timePeriodStart, end: timePeriodEnd }, { amount: 75.0, currencyCode: 'USD', currencySymbol: '$' }, true, true),
50
+ fetchCompletedTransactions(undefined, true),
51
+ ]);
52
+ }), takeUntil(actions$.pipe(filter(clearBulkUpload.match))));
53
+ }));
@@ -5,23 +5,27 @@ import { updateTransactions } from '../../../../entity/transaction/transactionRe
5
5
  import { isSuccessResponse } from '../../../../responsePayload';
6
6
  import { BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS } from '../../helpers/bulkUploadTiming';
7
7
  import { extractTransactionPayloadsFromBatchFiles, isBatchDetailsApiStatusCompleted, toBatchDetails, } from '../../payload/missingReceiptsPayload';
8
- import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, restoreBulkUploadMatchingState, } from '../../reducers/missingReceiptsViewReducer';
8
+ import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, refreshBatchDetailsForBatchId, restoreBulkUploadMatchingState, } from '../../reducers/missingReceiptsViewReducer';
9
9
  /** First poll after upload; then interval while batch not resolved via Pusher or API. */
10
10
  const FALLBACK_FIRST_DELAY_MS = 30000;
11
11
  /** Shorter first poll for restored sessions — batch may already be near completion. */
12
12
  const RESTORE_FIRST_DELAY_MS = 5000;
13
13
  const FALLBACK_POLL_INTERVAL_MS = 10000;
14
14
  /**
15
- * On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs).
16
- * Debounced to reduce duplicate refreshes. The post-match tab decision
17
- * (Unmatched vs Completed) is made client-side in `ExpenseAutomationPage` once fresh
15
+ * On Pusher batch completion: refresh the batch list (so summary counts update) and dispatch a
16
+ * targeted single-batch details refresh for the batch that just completed. Stale-while-revalidate:
17
+ * we no longer pass `invalidateBatchDetailsCache: true` existing `batchDetailsById` entries stay
18
+ * on screen and the just-completed row replaces in place via `storeBatchDetails`. The post-match
19
+ * tab decision (Unmatched vs Completed) is made client-side in `ExpenseAutomationPage` once fresh
18
20
  * batch details land -- do not dispatch `requestMissingReceiptsTabNavigation` here.
21
+ *
22
+ * Pusher resend storms (same batch completing twice within the dedupe window) are throttled in
23
+ * `refreshBatchDetailsForBatchIdEpic` via `lastBatchDetailRefreshAtById`, so this epic stays
24
+ * stateless and just forwards the event.
19
25
  */
20
- export const pusherBatchStatusCompletionEpic = (actions$) => actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.status === 'completed'), debounceTime(300), mergeMap(() => from([
21
- fetchBulkUploadBatches({
22
- cacheOverride: true,
23
- invalidateBatchDetailsCache: true,
24
- }),
26
+ export const pusherBatchStatusCompletionEpic = (actions$) => actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.status === 'completed'), debounceTime(300), mergeMap((action) => from([
27
+ fetchBulkUploadBatches({ cacheOverride: true }),
28
+ refreshBatchDetailsForBatchId({ batchId: action.payload.batchId }),
25
29
  ])));
26
30
  /**
27
31
  * If Pusher and batch-details are delayed beyond {@link BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS},
@@ -59,22 +59,6 @@ export const filterAutoTabLineItems = (tabView, transactionId, updatedTransactio
59
59
  }
60
60
  };
61
61
  export const MAX_SELECTION_LIMIT = 5;
62
- // Returns true when the transaction should be auto-added to the
63
- // selectedCheckBoxTransactionIds list after a categorization-related
64
- // state mutation: all line items are filled, the selection limit has
65
- // not been hit, and the id isn't already in the list. Consolidates the
66
- // triplet that was inlined at four sites (updateSelectedCustomer/Vendor,
67
- // setAllItemsToCategoryClassInLocalDataForCategorization, and
68
- // setEntityRecommendationForLineIdInLocalData below).
69
- export const shouldAutoSelectAndAdd = (transaction, localData, selectedCheckBoxTransactionIds, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) => {
70
- if (selectedCheckBoxTransactionIds.includes(transaction.id)) {
71
- return false;
72
- }
73
- if (selectedCheckBoxTransactionIds.length >= MAX_SELECTION_LIMIT) {
74
- return false;
75
- }
76
- return checkIfAllLineItemsAreCategoryClassFilled(transaction, localData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled);
77
- };
78
62
  export const toTransactionDetailLocalData = (transaction, selectedTab, lineItemsByTransactionIds, uncategorizedIncomeExpense, isUncategorizedExpenseCategoryEnabled) => {
79
63
  const transactionLocal = {
80
64
  ...initialSupportedTransactionCategorization.transactionReviewLocalData,
@@ -560,14 +544,10 @@ export const setEntityRecommendationForLineIdInLocalData = (draft, transaction,
560
544
  selectedEntity: transactionDetailLocalData.selectedEntity,
561
545
  tabSpecificLineItems: transactionDetailLocalData.tabSpecificLineItems,
562
546
  };
563
- // Auto-uncheck if not all line items are filled (the row's
564
- // category/class became stale after the entity update). Otherwise
565
- // route through shouldAutoSelectAndAdd so the MAX_SELECTION_LIMIT
566
- // gate is consistently applied across all auto-add sites.
567
547
  if (!checkIfAllLineItemsAreCategoryClassFilled(transaction, newLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled)) {
568
548
  selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
569
549
  }
570
- else if (shouldAutoSelectAndAdd(transaction, newLocalData, selectedCheckBoxTransactionIds, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled)) {
550
+ else if (selectedCheckBoxTransactionIds.includes(transaction.id) === false) {
571
551
  selectedCheckBoxTransactionIds.push(transaction.id);
572
552
  }
573
553
  draft.selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds;
@@ -10,6 +10,7 @@ export const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, s
10
10
  export const initialBulkUploadState = {
11
11
  batchDetailsById: {},
12
12
  batchDetailsPaginationState: { fetchState: 'Not-Started', error: undefined },
13
+ batchDetailsRevalidating: false,
13
14
  batchListByPeriod: {},
14
15
  batchListFetchState: { fetchState: 'Not-Started', error: undefined },
15
16
  batchStatusById: {},
@@ -19,6 +20,8 @@ export const initialBulkUploadState = {
19
20
  currentBatchId: undefined,
20
21
  currentResultsTab: 'unmatched',
21
22
  failedBatchDetailIds: [],
23
+ initialBatchDetailsLoaded: false,
24
+ lastBatchDetailRefreshAtById: {},
22
25
  manualSearchUiResetKey: 0,
23
26
  manualSearch: {
24
27
  fetchState: { fetchState: 'Not-Started', error: undefined },
@@ -65,6 +68,13 @@ export const fetchBulkUploadBatchDetails = createAction('expenseAutomationMissin
65
68
  * after a hard refresh. The epic owns the list + details API calls end-to-end.
66
69
  */
67
70
  export const restoreBulkUploadAutomatchingOnMount = createAction('expenseAutomationMissingReceiptsView/restoreBulkUploadAutomatchingOnMount');
71
+ /**
72
+ * Epic trigger only. Targeted stale-while-revalidate refresh for a single batch's details — used
73
+ * by `pusherBatchStatusCompletionEpic` so a Pusher 'completed' event re-fetches only that one
74
+ * batch instead of wiping the entire `batchDetailsById` cache. The epic dedupes via
75
+ * `lastBatchDetailRefreshAtById` so resend storms don't trigger waves of API calls.
76
+ */
77
+ export const refreshBatchDetailsForBatchId = createAction('expenseAutomationMissingReceiptsView/refreshBatchDetailsForBatchId');
68
78
  const expenseAutomationMissingReceiptsView = createSlice({
69
79
  name: 'expenseAutomationMissingReceiptsView',
70
80
  initialState,
@@ -251,6 +261,16 @@ const expenseAutomationMissingReceiptsView = createSlice({
251
261
  const details = action.payload;
252
262
  draft.bulkUpload.batchDetailsById[details.batchId] = details;
253
263
  draft.bulkUpload.phase = 'completed';
264
+ draft.bulkUpload.initialBatchDetailsLoaded = true;
265
+ /**
266
+ * A successful detail load supersedes any previous failure for this batch — without this,
267
+ * `getPrimaryBatchIdFromBatchListOrder` (and pagination) would keep skipping the batch
268
+ * across the recovery, hiding now-valid Unmatched-tab work.
269
+ */
270
+ const failedIndex = draft.bulkUpload.failedBatchDetailIds.indexOf(details.batchId);
271
+ if (failedIndex >= 0) {
272
+ draft.bulkUpload.failedBatchDetailIds.splice(failedIndex, 1);
273
+ }
254
274
  },
255
275
  fetchBulkUploadBatchDetailsFailure: {
256
276
  reducer(draft) {
@@ -272,6 +292,19 @@ const expenseAutomationMissingReceiptsView = createSlice({
272
292
  draft.bulkUpload.currentBatchId === details.batchId) {
273
293
  draft.bulkUpload.phase = 'completed';
274
294
  }
295
+ /** Stale-while-revalidate: any successful detail load means we have rendered data. */
296
+ draft.bulkUpload.initialBatchDetailsLoaded = true;
297
+ /**
298
+ * Stale-while-revalidate recovery: if this batch had previously failed, a successful
299
+ * targeted refresh (Pusher `completed` → `refreshBatchDetailsForBatchIdEpic`) or
300
+ * multi-batch revalidation (manual refresh) supersedes the failure. Selectors that gate
301
+ * on `failedBatchDetailIds` (primary-batch resolution, `hasMoreBatchDetails`) must see the
302
+ * batch as recovered so it can show fresh Unmatched work.
303
+ */
304
+ const failedIndex = draft.bulkUpload.failedBatchDetailIds.indexOf(details.batchId);
305
+ if (failedIndex >= 0) {
306
+ draft.bulkUpload.failedBatchDetailIds.splice(failedIndex, 1);
307
+ }
275
308
  },
276
309
  batchDetailFetchFailed(draft, action) {
277
310
  const { batchId } = action.payload;
@@ -300,6 +333,14 @@ const expenseAutomationMissingReceiptsView = createSlice({
300
333
  fetchState: 'Completed',
301
334
  error: undefined,
302
335
  };
336
+ /**
337
+ * Stale-while-revalidate: a completed pagination round means the initial page (or a
338
+ * subsequent revalidation) has fully resolved. Once `initialBatchDetailsLoaded` flips to
339
+ * `true` it stays `true` for the session — only `clearBulkUpload` /
340
+ * `clearBulkUploadBatchDetailsForScopeChange` can reset it.
341
+ */
342
+ draft.bulkUpload.initialBatchDetailsLoaded = true;
343
+ draft.bulkUpload.batchDetailsRevalidating = false;
303
344
  const currentId = draft.bulkUpload.currentBatchId;
304
345
  const currentDetails = currentId != null
305
346
  ? draft.bulkUpload.batchDetailsById[currentId]
@@ -315,12 +356,21 @@ const expenseAutomationMissingReceiptsView = createSlice({
315
356
  fetchState: 'Error',
316
357
  error: action.payload.error,
317
358
  };
359
+ draft.bulkUpload.batchDetailsRevalidating = false;
318
360
  },
319
361
  fetchBulkUploadBatches: {
320
362
  reducer(draft, action) {
363
+ /**
364
+ * Stale-while-revalidate: when caller asks for a full details refresh (manual refresh
365
+ * button), we keep `batchDetailsById` and `failedBatchDetailIds` intact so the existing
366
+ * UI stays rendered, and flip `batchDetailsRevalidating: true`. The post-success epic
367
+ * (`fetchMultipleBatchDetailsEpic`) sees this flag and re-fetches every completed list
368
+ * row, replacing entries via `storeBatchDetails` as each response arrives. This avoids
369
+ * the previous "wipe to empty → render skeleton" flash. To genuinely drop details (e.g.
370
+ * tenant/period scope change), use `clearBulkUploadBatchDetailsForScopeChange` instead.
371
+ */
321
372
  if (action.payload.invalidateBatchDetailsCache === true) {
322
- draft.bulkUpload.batchDetailsById = {};
323
- draft.bulkUpload.failedBatchDetailIds = [];
373
+ draft.bulkUpload.batchDetailsRevalidating = true;
324
374
  }
325
375
  draft.bulkUpload.batchListFetchState = {
326
376
  fetchState: 'In-Progress',
@@ -337,6 +387,31 @@ const expenseAutomationMissingReceiptsView = createSlice({
337
387
  };
338
388
  },
339
389
  },
390
+ /**
391
+ * Tenant/period scope change — the new scope's data is genuinely unknown so the existing
392
+ * details cache and `initialBatchDetailsLoaded` flag must be reset (the Unmatched skeleton
393
+ * is acceptable on scope change). Distinct from a stale-while-revalidate refresh.
394
+ */
395
+ clearBulkUploadBatchDetailsForScopeChange(draft) {
396
+ draft.bulkUpload.batchDetailsById = {};
397
+ draft.bulkUpload.failedBatchDetailIds = [];
398
+ draft.bulkUpload.batchDetailsPaginationState = {
399
+ fetchState: 'Not-Started',
400
+ error: undefined,
401
+ };
402
+ draft.bulkUpload.batchDetailsRevalidating = false;
403
+ draft.bulkUpload.initialBatchDetailsLoaded = false;
404
+ draft.bulkUpload.lastBatchDetailRefreshAtById = {};
405
+ },
406
+ /**
407
+ * Records the last time we issued a targeted refresh for `batchId`. Set by
408
+ * `refreshBatchDetailsForBatchIdEpic` before each API call so subsequent Pusher resends in the
409
+ * dedupe window are skipped.
410
+ */
411
+ markBatchDetailRefreshAttempted(draft, action) {
412
+ draft.bulkUpload.lastBatchDetailRefreshAtById[action.payload.batchId] =
413
+ action.payload.timestamp;
414
+ },
340
415
  fetchBulkUploadBatchesSuccess(draft, action) {
341
416
  const periodId = toMonthYearPeriodId(action.payload.selectedPeriod);
342
417
  draft.bulkUpload.batchListByPeriod[periodId] = action.payload.batchList;
@@ -579,7 +654,7 @@ const expenseAutomationMissingReceiptsView = createSlice({
579
654
  });
580
655
  export const { fetchMissingReceipts, fetchMissingReceiptsSuccess, fetchMissingReceiptsFailure, uploadMissingReceiptSuccess, updateMissingReceiptUploadState, updateMissingReceiptsUIState, markMissingReceiptAsDone, clearExpenseAutomationMissingReceiptsView,
581
656
  // Bulk Upload
582
- bulkUploadReceipts, updateBulkUploadProgress, setBulkUploadUploadedFileCount, bulkUploadReceiptsSuccess, bulkUploadReceiptsFailure, restoreBulkUploadMatchingState, bulkUploadAutomatchingTimedOut, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, clearMissingReceiptsTabNavigation, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatchDetailsFailure, storeBatchDetails, batchDetailFetchFailed, setInitialBatchDetailsLoading, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, fetchBulkUploadBatches, fetchBulkUploadBatchesSuccess, fetchBulkUploadBatchesFailure, confirmBulkUploadMatch, confirmBulkUploadMatchSuccess, confirmBulkUploadMatchFailure, setBulkUploadResultsTab, setBulkUploadCompletedSubTab, setBulkUploadSortConfig, clearBulkUpload, searchTransactionsForManualMatch, searchTransactionsForManualMatchSuccess, searchTransactionsForManualMatchFailure, clearManualSearchResults, acknowledgeBulkUploadConfirmMatchComplete,
657
+ bulkUploadReceipts, updateBulkUploadProgress, setBulkUploadUploadedFileCount, bulkUploadReceiptsSuccess, bulkUploadReceiptsFailure, restoreBulkUploadMatchingState, bulkUploadAutomatchingTimedOut, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, clearMissingReceiptsTabNavigation, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatchDetailsFailure, storeBatchDetails, batchDetailFetchFailed, setInitialBatchDetailsLoading, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, fetchBulkUploadBatches, fetchBulkUploadBatchesSuccess, fetchBulkUploadBatchesFailure, clearBulkUploadBatchDetailsForScopeChange, markBatchDetailRefreshAttempted, confirmBulkUploadMatch, confirmBulkUploadMatchSuccess, confirmBulkUploadMatchFailure, setBulkUploadResultsTab, setBulkUploadCompletedSubTab, setBulkUploadSortConfig, clearBulkUpload, searchTransactionsForManualMatch, searchTransactionsForManualMatchSuccess, searchTransactionsForManualMatchFailure, clearManualSearchResults, acknowledgeBulkUploadConfirmMatchComplete,
583
658
  // Completed Transactions
584
659
  fetchCompletedTransactions, fetchCompletedTransactionsSuccess, fetchCompletedTransactionsFailure, } = expenseAutomationMissingReceiptsView.actions;
585
660
  export default expenseAutomationMissingReceiptsView.reducer;
@@ -3,7 +3,7 @@ import recordGet from 'lodash/get';
3
3
  import uniq from 'lodash/uniq';
4
4
  import { toMonthYearPeriodId, } from '../../../commonStateTypes/timePeriod';
5
5
  import { isVendorTransaction } from '../../../entity/transaction/stateTypes/vendorTransaction';
6
- import { filterAutoTabLineItems, mergeTabSpecificLineItems, removeTransactionFromTabView, setEntityRecommendationForLineIdInLocalData, shouldAutoSelectAndAdd, toSetAllLineItemsToCategoryClass, toTransactionDetailLocalData, } from '../helpers/transactionCategorizationLocalDataHelper';
6
+ import { MAX_SELECTION_LIMIT, checkIfAllLineItemsAreCategoryClassFilled, filterAutoTabLineItems, mergeTabSpecificLineItems, removeTransactionFromTabView, setEntityRecommendationForLineIdInLocalData, toSetAllLineItemsToCategoryClass, toTransactionDetailLocalData, } from '../helpers/transactionCategorizationLocalDataHelper';
7
7
  import { DEFAULT_COMPLETED_SUB_TAB, } from '../types/completedSubTab';
8
8
  export const initialTransactionTabViewState = {
9
9
  saveStatus: {
@@ -420,9 +420,12 @@ const expenseAutomationTransactionsView = createSlice({
420
420
  const selectedCheckBoxTransactionIds = draft.transactionCategorizationView[selectedTab]
421
421
  .selectedCheckBoxTransactionIds;
422
422
  if (selectedTransaction != null &&
423
- shouldAutoSelectAndAdd(selectedTransaction, newTransactionLocalData, selectedCheckBoxTransactionIds, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled)) {
423
+ checkIfAllLineItemsAreCategoryClassFilled(selectedTransaction, newTransactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) === true && // check if all line items are filled
424
+ selectedCheckBoxTransactionIds.length < MAX_SELECTION_LIMIT &&
425
+ selectedCheckBoxTransactionIds.includes(transactionId) === false) {
424
426
  draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
425
- ...selectedCheckBoxTransactionIds,
427
+ ...draft.transactionCategorizationView[selectedTab]
428
+ .selectedCheckBoxTransactionIds,
426
429
  transactionId,
427
430
  ];
428
431
  }
@@ -505,26 +508,9 @@ const expenseAutomationTransactionsView = createSlice({
505
508
  const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
506
509
  .transactionReviewLocalDataById, transactionId.id, undefined);
507
510
  if (transactionLocalData != null) {
508
- const newLocalData = setEntityRecommendationForLineIdInLocalData(draft.transactionCategorizationView[selectedTab], transaction, transactionLocalData.transactionReviewLocalData, entity, lineIds, uncategorizedAccounts, action.payload.recommendationWithCOTByLineId, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled);
509
- // Release the per-line fetch flag for every line this fetch
510
- // covered. Done in-place on the freshly returned local data
511
- // (the helper produces a new mutable object), before we write
512
- // it back to the draft.
513
- lineIds.forEach((lineId) => {
514
- const lineItem = newLocalData.lineItemById[lineId];
515
- if (lineItem != null) {
516
- newLocalData.lineItemById[lineId] = {
517
- ...lineItem,
518
- categoryClassRecommendationsFetchState: {
519
- fetchState: 'Completed',
520
- error: undefined,
521
- },
522
- };
523
- }
524
- });
525
511
  draft.transactionCategorizationView[selectedTab].transactionReviewLocalDataById[transaction.id] = {
526
512
  transactionId: transaction.id,
527
- transactionReviewLocalData: newLocalData,
513
+ transactionReviewLocalData: setEntityRecommendationForLineIdInLocalData(draft.transactionCategorizationView[selectedTab], transaction, transactionLocalData.transactionReviewLocalData, entity, lineIds, uncategorizedAccounts, action.payload.recommendationWithCOTByLineId, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled),
528
514
  };
529
515
  // Mark transaction as dirty (autofill happened)
530
516
  if (!draft.transactionCategorizationView[selectedTab].transactionIdsWithUnsavedData.includes(transaction.id)) {
@@ -537,99 +523,6 @@ const expenseAutomationTransactionsView = createSlice({
537
523
  }
538
524
  },
539
525
  },
540
- // Start arm of the line-update recommendations fetch. Flips covered
541
- // lines to In-Progress AND removes the transaction from
542
- // selectedCheckBoxTransactionIds — the row is unchecked + disabled
543
- // until either the success arm (recheck if limit allows) or the
544
- // failure arm releases the per-line flag.
545
- markCategoryClassRecommendationsInProgressForCategorization: {
546
- reducer(draft, action) {
547
- const { selectedTab, transactionId, lineIds } = action.payload;
548
- const tab = draft.transactionCategorizationView[selectedTab];
549
- const transactionLocalData = recordGet(tab.transactionReviewLocalDataById, transactionId.id, undefined);
550
- if (transactionLocalData != null) {
551
- lineIds.forEach((lineId) => {
552
- const lineItem = transactionLocalData.transactionReviewLocalData.lineItemById[lineId];
553
- if (lineItem != null) {
554
- transactionLocalData.transactionReviewLocalData.lineItemById[lineId] = {
555
- ...lineItem,
556
- categoryClassRecommendationsFetchState: {
557
- fetchState: 'In-Progress',
558
- error: undefined,
559
- },
560
- };
561
- }
562
- });
563
- }
564
- // Uncheck on fetch start: the row's existing category/class are
565
- // stale after a payee change, so we drop the auto-selection until
566
- // fresh recommendations land.
567
- if (tab.selectedCheckBoxTransactionIds.includes(transactionId.id)) {
568
- tab.selectedCheckBoxTransactionIds =
569
- tab.selectedCheckBoxTransactionIds.filter((id) => id !== transactionId.id);
570
- }
571
- },
572
- prepare(selectedTab, transactionId, lineIds) {
573
- return { payload: { selectedTab, transactionId, lineIds } };
574
- },
575
- },
576
- // Completed arm. Used by the epic when the HTTP call succeeds but the
577
- // server returned no per-line recommendations — we still need to
578
- // release the In-Progress flag so the skeleton resolves. Successful
579
- // responses with recommendations go through
580
- // setEntityRecommendationForLineIdsForCategorization instead (which
581
- // also flips the lines to Completed).
582
- markCategoryClassRecommendationsCompletedForCategorization: {
583
- reducer(draft, action) {
584
- const { selectedTab, transactionId, lineIds } = action.payload;
585
- const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
586
- .transactionReviewLocalDataById, transactionId.id, undefined);
587
- if (transactionLocalData != null) {
588
- lineIds.forEach((lineId) => {
589
- const lineItem = transactionLocalData.transactionReviewLocalData.lineItemById[lineId];
590
- if (lineItem != null) {
591
- transactionLocalData.transactionReviewLocalData.lineItemById[lineId] = {
592
- ...lineItem,
593
- categoryClassRecommendationsFetchState: {
594
- fetchState: 'Completed',
595
- error: undefined,
596
- },
597
- };
598
- }
599
- });
600
- }
601
- },
602
- prepare(selectedTab, transactionId, lineIds) {
603
- return { payload: { selectedTab, transactionId, lineIds } };
604
- },
605
- },
606
- // Failure arm. Flips covered lines to Error so the skeleton resolves
607
- // and downstream UI can react to the failure. The transaction stays
608
- // unchecked from the start-arm action.
609
- markCategoryClassRecommendationsFailureForCategorization: {
610
- reducer(draft, action) {
611
- const { selectedTab, transactionId, lineIds, error } = action.payload;
612
- const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
613
- .transactionReviewLocalDataById, transactionId.id, undefined);
614
- if (transactionLocalData != null) {
615
- lineIds.forEach((lineId) => {
616
- const lineItem = transactionLocalData.transactionReviewLocalData.lineItemById[lineId];
617
- if (lineItem != null) {
618
- transactionLocalData.transactionReviewLocalData.lineItemById[lineId] = {
619
- ...lineItem,
620
- categoryClassRecommendationsFetchState: {
621
- fetchState: 'Error',
622
- error,
623
- },
624
- };
625
- }
626
- });
627
- }
628
- },
629
- prepare(selectedTab, transactionId, lineIds, error) {
630
- return { payload: { selectedTab, transactionId, lineIds, error } };
631
- },
632
- },
633
526
  fetchTransactionCategorizationSuccess(draft, action) {
634
527
  const { selectedTab, refreshViewInBackground } = action.payload;
635
528
  if (draft.transactionCategorizationView[selectedTab].fetchState ===
@@ -725,7 +618,9 @@ const expenseAutomationTransactionsView = createSlice({
725
618
  .selectedCheckBoxTransactionIds;
726
619
  if (newTransactionLocalData.customer != null &&
727
620
  newTransactionLocalData.customer.id != null &&
728
- shouldAutoSelectAndAdd(selectedTransaction, newTransactionLocalData, selectedCheckBoxTransactionIds, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled)) {
621
+ checkIfAllLineItemsAreCategoryClassFilled(selectedTransaction, newTransactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) === true && // check if all line items are filled
622
+ selectedCheckBoxTransactionIds.length < MAX_SELECTION_LIMIT &&
623
+ selectedCheckBoxTransactionIds.includes(transactionId) === false) {
729
624
  draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
730
625
  ...selectedCheckBoxTransactionIds,
731
626
  transactionId,
@@ -799,7 +694,9 @@ const expenseAutomationTransactionsView = createSlice({
799
694
  .selectedCheckBoxTransactionIds;
800
695
  if (newTransactionLocalData.vendor != null &&
801
696
  newTransactionLocalData.vendor.id != null &&
802
- shouldAutoSelectAndAdd(selectedTransaction, newTransactionLocalData, selectedCheckBoxTransactionIds, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled)) {
697
+ checkIfAllLineItemsAreCategoryClassFilled(selectedTransaction, newTransactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) === true && // check if all line items are filled
698
+ selectedCheckBoxTransactionIds.length < MAX_SELECTION_LIMIT &&
699
+ selectedCheckBoxTransactionIds.includes(transactionId) === false) {
803
700
  draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
804
701
  ...selectedCheckBoxTransactionIds,
805
702
  transactionId,
@@ -1032,5 +929,5 @@ const expenseAutomationTransactionsView = createSlice({
1032
929
  },
1033
930
  },
1034
931
  });
1035
- export const { fetchTransactionCategorization, updateTransactionCategorizationUIState, initializeTransactionCategorizationViewLocalData, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationCompletedSubTab, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateStatusForTransactionNotMiscategorizedUpdateForCategorization, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, setAllItemsToCategoryClassInLocalDataForCategorization, updateTotalCountForTransactionCategorization, updateParentTotalCountForTab, fetchTransactionCategorizationSuccess, resetOtherTabsFetchState, fetchTransactionCategorizationView, updateSelectedCheckboxTransactionIds, clearExpenseAutomationTransactionsViewPerTabView, clearExpenseAutomationTransactionsView, setEntityRecommendationForLineIdsForCategorization, markCategoryClassRecommendationsInProgressForCategorization, markCategoryClassRecommendationsCompletedForCategorization, markCategoryClassRecommendationsFailureForCategorization, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, } = expenseAutomationTransactionsView.actions;
932
+ export const { fetchTransactionCategorization, updateTransactionCategorizationUIState, initializeTransactionCategorizationViewLocalData, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationCompletedSubTab, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateStatusForTransactionNotMiscategorizedUpdateForCategorization, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, setAllItemsToCategoryClassInLocalDataForCategorization, updateTotalCountForTransactionCategorization, updateParentTotalCountForTab, fetchTransactionCategorizationSuccess, resetOtherTabsFetchState, fetchTransactionCategorizationView, updateSelectedCheckboxTransactionIds, clearExpenseAutomationTransactionsViewPerTabView, clearExpenseAutomationTransactionsView, setEntityRecommendationForLineIdsForCategorization, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, } = expenseAutomationTransactionsView.actions;
1036
933
  export default expenseAutomationTransactionsView.reducer;
@@ -224,6 +224,8 @@ export function getExpenseAutomationMissingReceiptsView(state) {
224
224
  manualSearchUiResetKey: bulkUpload.manualSearchUiResetKey,
225
225
  hasMoreBatchDetails,
226
226
  batchDetailsPaginationState: bulkUpload.batchDetailsPaginationState,
227
+ batchDetailsRevalidating: bulkUpload.batchDetailsRevalidating,
228
+ initialBatchDetailsLoaded: bulkUpload.initialBatchDetailsLoaded,
227
229
  manualSearch: {
228
230
  ...bulkUpload.manualSearch,
229
231
  results: manualSearchResults,