@zeniai/client-epic-state 5.0.69-betaML6 → 5.0.69-betaML8
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.
|
@@ -238,12 +238,34 @@ const transactionDetail = createSlice({
|
|
|
238
238
|
saveTransactionDetailLocalData(draft, action) {
|
|
239
239
|
const key = getTransactionDetailKey(action.payload.transactionId);
|
|
240
240
|
const detail = recordGet(draft.transactionDetailById, key, undefined);
|
|
241
|
-
if (detail
|
|
242
|
-
|
|
243
|
-
...detail,
|
|
244
|
-
transactionDetailLocalData: action.payload.transactionLocalData,
|
|
245
|
-
};
|
|
241
|
+
if (detail == null) {
|
|
242
|
+
return;
|
|
246
243
|
}
|
|
244
|
+
const incoming = action.payload.transactionLocalData;
|
|
245
|
+
const prevById = detail.transactionDetailLocalData.lineItemById;
|
|
246
|
+
// Per-line `categoryClassRecommendationsFetchState` is owned by the
|
|
247
|
+
// recommendation epic/reducers (markInProgress / markCompleted /
|
|
248
|
+
// markFailure / setEntityRecommendationForLineIdsForTransactionDetail).
|
|
249
|
+
// Callers that rebuild `transactionLocalData` from a UI snapshot will
|
|
250
|
+
// typically have an out-of-date copy of this field (e.g. payee-change
|
|
251
|
+
// captures the snapshot before the epic's start arm runs and would
|
|
252
|
+
// otherwise clobber In-Progress back to undefined). Treat the field as
|
|
253
|
+
// sticky: only let the caller override it when they explicitly set it.
|
|
254
|
+
const mergedLineItemById = {};
|
|
255
|
+
Object.entries(incoming.lineItemById ?? {}).forEach(([lineId, line]) => {
|
|
256
|
+
mergedLineItemById[lineId] = {
|
|
257
|
+
...line,
|
|
258
|
+
categoryClassRecommendationsFetchState: line.categoryClassRecommendationsFetchState ??
|
|
259
|
+
prevById?.[lineId]?.categoryClassRecommendationsFetchState,
|
|
260
|
+
};
|
|
261
|
+
});
|
|
262
|
+
draft.transactionDetailById[key] = {
|
|
263
|
+
...detail,
|
|
264
|
+
transactionDetailLocalData: {
|
|
265
|
+
...incoming,
|
|
266
|
+
lineItemById: mergedLineItemById,
|
|
267
|
+
},
|
|
268
|
+
};
|
|
247
269
|
},
|
|
248
270
|
saveTransactionDetail(draft, action) {
|
|
249
271
|
const key = getTransactionDetailKey(action.payload.transactionId);
|
|
@@ -245,12 +245,34 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
245
245
|
saveTransactionDetailLocalData(draft, action) {
|
|
246
246
|
const key = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
|
|
247
247
|
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
248
|
-
if (detail
|
|
249
|
-
|
|
250
|
-
...detail,
|
|
251
|
-
transactionDetailLocalData: action.payload.transactionLocalData,
|
|
252
|
-
};
|
|
248
|
+
if (detail == null) {
|
|
249
|
+
return;
|
|
253
250
|
}
|
|
251
|
+
const incoming = action.payload.transactionLocalData;
|
|
252
|
+
const prevById = detail.transactionDetailLocalData.lineItemById;
|
|
253
|
+
// Per-line `categoryClassRecommendationsFetchState` is owned by the
|
|
254
|
+
// recommendation epic/reducers (markInProgress / markCompleted /
|
|
255
|
+
// markFailure / setEntityRecommendationForLineIdsForTransactionDetail).
|
|
256
|
+
// Callers that rebuild `transactionLocalData` from a UI snapshot will
|
|
257
|
+
// typically have an out-of-date copy of this field (e.g. payee-change
|
|
258
|
+
// captures the snapshot before the epic's start arm runs and would
|
|
259
|
+
// otherwise clobber In-Progress back to undefined). Treat the field as
|
|
260
|
+
// sticky: only let the caller override it when they explicitly set it.
|
|
261
|
+
const mergedLineItemById = {};
|
|
262
|
+
Object.entries(incoming.lineItemById ?? {}).forEach(([lineId, line]) => {
|
|
263
|
+
mergedLineItemById[lineId] = {
|
|
264
|
+
...line,
|
|
265
|
+
categoryClassRecommendationsFetchState: line.categoryClassRecommendationsFetchState ??
|
|
266
|
+
prevById?.[lineId]?.categoryClassRecommendationsFetchState,
|
|
267
|
+
};
|
|
268
|
+
});
|
|
269
|
+
draft.transactionDetailById[key] = {
|
|
270
|
+
...detail,
|
|
271
|
+
transactionDetailLocalData: {
|
|
272
|
+
...incoming,
|
|
273
|
+
lineItemById: mergedLineItemById,
|
|
274
|
+
},
|
|
275
|
+
};
|
|
254
276
|
},
|
|
255
277
|
saveTransactionDetail(draft, action) {
|
|
256
278
|
const key = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.69-
|
|
3
|
+
"version": "5.0.69-betaML8",
|
|
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",
|