@zeniai/client-epic-state 5.0.66-betaAR5 → 5.0.66-betaAR6

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.
@@ -75,25 +75,27 @@ export function getExpenseAutomationTransactionView(state) {
75
75
  // Also include transactionLocalData for transactions that don't exist in transactionState
76
76
  // but have local data (to match original behavior)
77
77
  const filteredTransactionIds = new Set(filteredTransactionViews.map((view) => view.id));
78
- const filteredTransactionLocalData = transactionIds
79
- .map((transactionId) => {
78
+ // `.flatMap` returns `X[]` directly when the callback returns `[]` for the
79
+ // skip case, so we don't need the trailing `.filter((d): d is X => …)` type
80
+ // predicate that the previous `map → filter` pipeline required.
81
+ const filteredTransactionLocalData = transactionIds.flatMap((transactionId) => {
80
82
  const transactionData = transactionReviewLocalDataById[transactionId];
81
83
  if (transactionData == null) {
82
- return null;
84
+ return [];
83
85
  }
84
86
  // Include if transaction is in filtered results, or if transaction doesn't exist in state
85
87
  // (to maintain backward compatibility with tests)
86
88
  const transactionExists = transactions.some((t) => t.id === transactionId);
87
- if (filteredTransactionIds.has(transactionId) ||
88
- !transactionExists) {
89
- return {
90
- transactionId,
91
- transactionReviewLocalData: transactionData.transactionReviewLocalData,
92
- };
89
+ if (filteredTransactionIds.has(transactionId) || !transactionExists) {
90
+ return [
91
+ {
92
+ transactionId,
93
+ transactionReviewLocalData: transactionData.transactionReviewLocalData,
94
+ },
95
+ ];
93
96
  }
94
- return null;
95
- })
96
- .filter((data) => data != null);
97
+ return [];
98
+ });
97
99
  const monthEndFetchState = monthYearPeriodId != null
98
100
  ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
99
101
  : { fetchState: 'Not-Started', error: undefined };