@zeniai/client-epic-state 5.2.35-beta10MM → 5.2.35-beta11MM

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.
@@ -71,6 +71,22 @@ function pruneLastMatchResultsForUndone(draft, matchId, results) {
71
71
  }
72
72
  draft.lastMatchResultsByMatchId[matchId] = kept;
73
73
  }
74
+ function pruneLastUndoResultsForMatched(draft, matchId, results) {
75
+ const matchedIds = new Set(results.map((result) => result.accrualId));
76
+ if (matchedIds.size === 0) {
77
+ return;
78
+ }
79
+ const existing = draft.lastUndoResultsByMatchId[matchId];
80
+ if (existing == null) {
81
+ return;
82
+ }
83
+ const kept = existing.filter((result) => !matchedIds.has(result.accrualId));
84
+ if (kept.length === 0) {
85
+ delete draft.lastUndoResultsByMatchId[matchId];
86
+ return;
87
+ }
88
+ draft.lastUndoResultsByMatchId[matchId] = kept;
89
+ }
74
90
  function resetMatchModalSearches(draft) {
75
91
  draft.matchModal.transactionSearch = initialTransactionSearchState;
76
92
  draft.matchModal.accrualSearch = initialAccrualSearchState;
@@ -370,6 +386,7 @@ const expenseAutomationActualMatchingView = createSlice({
370
386
  if (action.payload.matchId != null) {
371
387
  draft.lastMatchResultsByMatchId[action.payload.matchId] =
372
388
  action.payload.results;
389
+ pruneLastUndoResultsForMatched(draft, action.payload.matchId, action.payload.results);
373
390
  }
374
391
  },
375
392
  matchAndReverseAccrualsFailure(draft, action) {
@@ -75,6 +75,22 @@ function pruneLastMatchResultsForUndone(draft, matchId, results) {
75
75
  }
76
76
  draft.lastMatchResultsByMatchId[matchId] = kept;
77
77
  }
78
+ function pruneLastUndoResultsForMatched(draft, matchId, results) {
79
+ const matchedIds = new Set(results.map((result) => result.accrualId));
80
+ if (matchedIds.size === 0) {
81
+ return;
82
+ }
83
+ const existing = draft.lastUndoResultsByMatchId[matchId];
84
+ if (existing == null) {
85
+ return;
86
+ }
87
+ const kept = existing.filter((result) => !matchedIds.has(result.accrualId));
88
+ if (kept.length === 0) {
89
+ delete draft.lastUndoResultsByMatchId[matchId];
90
+ return;
91
+ }
92
+ draft.lastUndoResultsByMatchId[matchId] = kept;
93
+ }
78
94
  function resetMatchModalSearches(draft) {
79
95
  draft.matchModal.transactionSearch = exports.initialTransactionSearchState;
80
96
  draft.matchModal.accrualSearch = exports.initialAccrualSearchState;
@@ -374,6 +390,7 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
374
390
  if (action.payload.matchId != null) {
375
391
  draft.lastMatchResultsByMatchId[action.payload.matchId] =
376
392
  action.payload.results;
393
+ pruneLastUndoResultsForMatched(draft, action.payload.matchId, action.payload.results);
377
394
  }
378
395
  },
379
396
  matchAndReverseAccrualsFailure(draft, action) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.35-beta10MM",
3
+ "version": "5.2.35-beta11MM",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",