@colyseus/schema 3.0.45 → 3.0.47
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/build/cjs/index.js +4 -3
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +4 -3
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +4 -3
- package/lib/encoder/ChangeTree.js +3 -1
- package/lib/encoder/ChangeTree.js.map +1 -1
- package/lib/encoder/Root.js +0 -1
- package/lib/encoder/Root.js.map +1 -1
- package/lib/encoder/StateView.js +1 -1
- package/lib/encoder/StateView.js.map +1 -1
- package/package.json +1 -1
- package/src/encoder/ChangeTree.ts +3 -1
- package/src/encoder/Root.ts +0 -1
- package/src/encoder/StateView.ts +1 -1
package/build/esm/index.mjs
CHANGED
|
@@ -1424,7 +1424,9 @@ class ChangeTree {
|
|
|
1424
1424
|
*/
|
|
1425
1425
|
addParent(parent, index) {
|
|
1426
1426
|
// Check if this parent already exists in the chain
|
|
1427
|
-
if (this.hasParent((p,
|
|
1427
|
+
if (this.hasParent((p, _) => p[$changes] === parent[$changes])) {
|
|
1428
|
+
// if (this.hasParent((p, i) => p[$changes] === parent[$changes] && i === index)) {
|
|
1429
|
+
this.parentChain.index = index;
|
|
1428
1430
|
return;
|
|
1429
1431
|
}
|
|
1430
1432
|
this.parentChain = {
|
|
@@ -3922,7 +3924,6 @@ class Root {
|
|
|
3922
3924
|
}
|
|
3923
3925
|
remove(changeTree) {
|
|
3924
3926
|
const refCount = (this.refCount[changeTree.refId]) - 1;
|
|
3925
|
-
// console.log("REMOVE", { refId: changeTree.refId, refCount });
|
|
3926
3927
|
if (refCount <= 0) {
|
|
3927
3928
|
//
|
|
3928
3929
|
// Only remove "root" reference if it's the last reference
|
|
@@ -5159,7 +5160,7 @@ class StateView {
|
|
|
5159
5160
|
if (tag === DEFAULT_VIEW_TAG) {
|
|
5160
5161
|
// parent is collection (Map/Array)
|
|
5161
5162
|
const parent = changeTree.parent;
|
|
5162
|
-
if (!Metadata.isValidInstance(parent) && changeTree.isFiltered) {
|
|
5163
|
+
if (parent && !Metadata.isValidInstance(parent) && changeTree.isFiltered) {
|
|
5163
5164
|
const parentChangeTree = parent[$changes];
|
|
5164
5165
|
let changes = this.changes.get(parentChangeTree.refId);
|
|
5165
5166
|
if (changes === undefined) {
|