@colyseus/react 0.1.2 → 0.1.3
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 +3 -3
- package/dist/index.mjs +4 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -108,9 +108,9 @@ function createSnapshot(node, ctx) {
|
|
|
108
108
|
const savedParentRefId = ctx.currentParentRefId;
|
|
109
109
|
ctx.currentParentRefId = refId;
|
|
110
110
|
let result;
|
|
111
|
-
if (node
|
|
112
|
-
else if (node
|
|
113
|
-
else if (
|
|
111
|
+
if (typeof node["set"] === "function") result = createSnapshotForMapSchema(node, previousResult, ctx);
|
|
112
|
+
else if (typeof node["push"] === "function") result = createSnapshotForArraySchema(node, previousResult, ctx);
|
|
113
|
+
else if (_colyseus_schema.Schema.isSchema(node)) result = createSnapshotForSchema(node, previousResult, ctx);
|
|
114
114
|
else result = node;
|
|
115
115
|
ctx.currentParentRefId = savedParentRefId;
|
|
116
116
|
if (refId !== -1) ctx.currentResultsByRefId.set(refId, result);
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useSyncExternalStore } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Schema } from "@colyseus/schema";
|
|
3
3
|
|
|
4
4
|
//#region src/schema/createSnapshot.ts
|
|
5
5
|
/**
|
|
@@ -108,9 +108,9 @@ function createSnapshot(node, ctx) {
|
|
|
108
108
|
const savedParentRefId = ctx.currentParentRefId;
|
|
109
109
|
ctx.currentParentRefId = refId;
|
|
110
110
|
let result;
|
|
111
|
-
if (node
|
|
112
|
-
else if (node
|
|
113
|
-
else if (node
|
|
111
|
+
if (typeof node["set"] === "function") result = createSnapshotForMapSchema(node, previousResult, ctx);
|
|
112
|
+
else if (typeof node["push"] === "function") result = createSnapshotForArraySchema(node, previousResult, ctx);
|
|
113
|
+
else if (Schema.isSchema(node)) result = createSnapshotForSchema(node, previousResult, ctx);
|
|
114
114
|
else result = node;
|
|
115
115
|
ctx.currentParentRefId = savedParentRefId;
|
|
116
116
|
if (refId !== -1) ctx.currentResultsByRefId.set(refId, result);
|