@zeniai/client-epic-state 4.13.88 → 4.13.90

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.
@@ -94,7 +94,19 @@ function doUpdateTransaction(draft, id, payload, updateType) {
94
94
  const transaction = (0, toSupportedTransaction_1.default)(payload);
95
95
  const existingTransaction = draft[id];
96
96
  if (existingTransaction != null && updateType === 'merge') {
97
- (0, assignWith_1.default)(draft[id], transaction, (objValue, srcValue) => srcValue !== null && srcValue !== void 0 ? srcValue : objValue); // IMPORTANT: replace the value only when source has valid value. Otherwise keep the existing value!
97
+ (0, assignWith_1.default)(draft[id], transaction, (objValue, srcValue, key) => {
98
+ if (key === 'lines') {
99
+ if (objValue != null && srcValue != null) {
100
+ const newLineIds = srcValue.map((line) => line.id);
101
+ return [
102
+ ...objValue.filter((line) => newLineIds.includes(line.id) === false),
103
+ ...srcValue,
104
+ ];
105
+ }
106
+ return srcValue !== null && srcValue !== void 0 ? srcValue : objValue;
107
+ }
108
+ return srcValue !== null && srcValue !== void 0 ? srcValue : objValue;
109
+ }); // IMPORTANT: replace the value only when source has valid value. Otherwise keep the existing value!
98
110
  }
99
111
  else {
100
112
  draft[id] = transaction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.13.88",
3
+ "version": "4.13.90",
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
  "types": "lib/index.d.ts",