@colyseus/react 0.1.3 → 0.1.4
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/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -151,6 +151,7 @@ function getOrCreateSubscription(roomState, decoder) {
|
|
|
151
151
|
originalDecode: decoder.decode
|
|
152
152
|
};
|
|
153
153
|
decoder.decode = function(...args) {
|
|
154
|
+
subscription.dirtyRefIds.clear();
|
|
154
155
|
const changes = subscription.originalDecode.apply(decoder, args);
|
|
155
156
|
if (changes && changes.length > 0) {
|
|
156
157
|
const refs = decoder.root?.refs;
|
|
@@ -227,7 +228,6 @@ function useColyseusState(roomState, decoder, selector = (s) => s) {
|
|
|
227
228
|
const result = createSnapshot(selectedState, ctx);
|
|
228
229
|
for (const [refId, value] of ctx.currentResultsByRefId) subscription.previousResultsByRefId.set(refId, value);
|
|
229
230
|
subscription.objectToRefId = ctx.objectToRefId;
|
|
230
|
-
subscription.dirtyRefIds.clear();
|
|
231
231
|
if (++subscription.cleanupCounter >= 100 && ctx.refs) {
|
|
232
232
|
subscription.cleanupCounter = 0;
|
|
233
233
|
for (const refId of subscription.previousResultsByRefId.keys()) if (!ctx.refs.has(refId)) {
|
package/dist/index.mjs
CHANGED
|
@@ -151,6 +151,7 @@ function getOrCreateSubscription(roomState, decoder) {
|
|
|
151
151
|
originalDecode: decoder.decode
|
|
152
152
|
};
|
|
153
153
|
decoder.decode = function(...args) {
|
|
154
|
+
subscription.dirtyRefIds.clear();
|
|
154
155
|
const changes = subscription.originalDecode.apply(decoder, args);
|
|
155
156
|
if (changes && changes.length > 0) {
|
|
156
157
|
const refs = decoder.root?.refs;
|
|
@@ -227,7 +228,6 @@ function useColyseusState(roomState, decoder, selector = (s) => s) {
|
|
|
227
228
|
const result = createSnapshot(selectedState, ctx);
|
|
228
229
|
for (const [refId, value] of ctx.currentResultsByRefId) subscription.previousResultsByRefId.set(refId, value);
|
|
229
230
|
subscription.objectToRefId = ctx.objectToRefId;
|
|
230
|
-
subscription.dirtyRefIds.clear();
|
|
231
231
|
if (++subscription.cleanupCounter >= 100 && ctx.refs) {
|
|
232
232
|
subscription.cleanupCounter = 0;
|
|
233
233
|
for (const refId of subscription.previousResultsByRefId.keys()) if (!ctx.refs.has(refId)) {
|