teamplay 0.2.0 → 0.2.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teamplay",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Full-stack signals ORM with multiplayer",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -23,12 +23,12 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@nx-js/observer-util": "^4.1.3",
26
- "@teamplay/backend": "^0.2.0",
27
- "@teamplay/cache": "^0.2.0",
28
- "@teamplay/channel": "^0.2.0",
29
- "@teamplay/debug": "^0.2.0",
30
- "@teamplay/schema": "^0.2.0",
31
- "@teamplay/utils": "^0.2.0",
26
+ "@teamplay/backend": "^0.2.2",
27
+ "@teamplay/cache": "^0.2.2",
28
+ "@teamplay/channel": "^0.2.2",
29
+ "@teamplay/debug": "^0.2.2",
30
+ "@teamplay/schema": "^0.2.2",
31
+ "@teamplay/utils": "^0.2.2",
32
32
  "diff-match-patch": "^1.0.5",
33
33
  "events": "^3.3.0",
34
34
  "json0-ot-diff": "^1.1.2",
@@ -63,5 +63,5 @@
63
63
  ]
64
64
  },
65
65
  "license": "MIT",
66
- "gitHead": "34435bba6654d480cac0e809defc15e1d15bd543"
66
+ "gitHead": "a3c17b5956a4ff67393906cf5421b3101771b39f"
67
67
  }
@@ -1,3 +1,5 @@
1
+ import isPlainObject from 'lodash/isPlainObject.js'
2
+
1
3
  export default function setDiffDeep (existing, updated) {
2
4
  // Handle primitive types, null, and type mismatches
3
5
  if (existing === null || updated === null ||
@@ -6,6 +8,10 @@ export default function setDiffDeep (existing, updated) {
6
8
  return updated
7
9
  }
8
10
 
11
+ // If the referenced value is the same it means that nothing has changed
12
+ // so we just return the original reference
13
+ if (existing === updated) return existing
14
+
9
15
  // Handle arrays
10
16
  if (Array.isArray(updated)) {
11
17
  existing.length = updated.length
@@ -15,6 +21,10 @@ export default function setDiffDeep (existing, updated) {
15
21
  return existing
16
22
  }
17
23
 
24
+ // Handle non-plain objects - just return them as-is to fully overwrite
25
+ // and don't try to update an old object in-place
26
+ if (!isPlainObject(updated)) return updated
27
+
18
28
  // Handle objects
19
29
  for (const key in existing) {
20
30
  if (!(key in updated)) {