@colyseus/schema 3.0.0-alpha.16 → 3.0.0-alpha.17
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 +9 -4
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +9 -4
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +9 -4
- package/lib/encoder/StateView.js +9 -4
- package/lib/encoder/StateView.js.map +1 -1
- package/package.json +1 -1
- package/src/encoder/StateView.ts +10 -7
package/build/esm/index.mjs
CHANGED
|
@@ -4230,12 +4230,18 @@ class StateView {
|
|
|
4230
4230
|
console.warn("StateView#add(), invalid object:", obj);
|
|
4231
4231
|
return this;
|
|
4232
4232
|
}
|
|
4233
|
+
// FIXME: ArraySchema/MapSchema does not have metadata
|
|
4234
|
+
const metadata = obj.constructor[Symbol.metadata];
|
|
4233
4235
|
let changeTree = obj[$changes];
|
|
4234
4236
|
this.items.add(changeTree);
|
|
4235
4237
|
// Add children of this ChangeTree to this view
|
|
4236
|
-
changeTree.forEachChild((change,
|
|
4237
|
-
|
|
4238
|
-
|
|
4238
|
+
changeTree.forEachChild((change, index) => {
|
|
4239
|
+
// Do not ADD children that don't have the same tag
|
|
4240
|
+
if (metadata && metadata[metadata[index]].tag !== tag) {
|
|
4241
|
+
return;
|
|
4242
|
+
}
|
|
4243
|
+
this.add(change.ref, tag);
|
|
4244
|
+
});
|
|
4239
4245
|
// add parent ChangeTree's, if they are invisible to this view
|
|
4240
4246
|
// TODO: REFACTOR addParent()
|
|
4241
4247
|
this.addParent(changeTree, tag);
|
|
@@ -4262,7 +4268,6 @@ class StateView {
|
|
|
4262
4268
|
tags = this.tags.get(changeTree);
|
|
4263
4269
|
}
|
|
4264
4270
|
tags.add(tag);
|
|
4265
|
-
// console.log("BY TAG:", tag);
|
|
4266
4271
|
// Ref: add tagged properties
|
|
4267
4272
|
metadata?.[-3]?.[tag]?.forEach((index) => {
|
|
4268
4273
|
if (changeTree.getChange(index) !== OPERATION.DELETE) {
|