@colyseus/schema 4.0.12 → 4.0.13
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/index.cjs +5 -1
- package/build/index.cjs.map +1 -1
- package/build/index.js +5 -1
- package/build/index.mjs +5 -1
- package/build/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/decoder/strategy/Callbacks.ts +5 -1
package/package.json
CHANGED
|
@@ -86,15 +86,19 @@ export class StateCallbackStrategy<TState extends IRef> {
|
|
|
86
86
|
|
|
87
87
|
// Collection not available yet. Listen for its availability before attaching the handler.
|
|
88
88
|
if (!collection || collection[$refId] === undefined) {
|
|
89
|
-
|
|
89
|
+
let removePropertyCallback: () => void;
|
|
90
|
+
removePropertyCallback = this.addCallback(
|
|
90
91
|
instance[$refId],
|
|
91
92
|
propertyName,
|
|
92
93
|
(value: TReturn, _: TReturn) => {
|
|
93
94
|
if (value !== null && value !== undefined) {
|
|
95
|
+
// Remove the property listener now that collection is available
|
|
96
|
+
removePropertyCallback();
|
|
94
97
|
removeHandler = this.addCallback(value[$refId], operation, handler);
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
);
|
|
101
|
+
removeHandler = removePropertyCallback;
|
|
98
102
|
return removeOnAdd;
|
|
99
103
|
|
|
100
104
|
} else {
|