@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 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 instanceof _colyseus_schema.MapSchema) result = createSnapshotForMapSchema(node, previousResult, ctx);
112
- else if (node instanceof _colyseus_schema.ArraySchema) result = createSnapshotForArraySchema(node, previousResult, ctx);
113
- else if (node instanceof _colyseus_schema.Schema) result = createSnapshotForSchema(node, previousResult, ctx);
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 { ArraySchema, MapSchema, Schema } from "@colyseus/schema";
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 instanceof MapSchema) result = createSnapshotForMapSchema(node, previousResult, ctx);
112
- else if (node instanceof ArraySchema) result = createSnapshotForArraySchema(node, previousResult, ctx);
113
- else if (node instanceof Schema) result = createSnapshotForSchema(node, previousResult, ctx);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colyseus/react",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "tsdown --watch --format esm,cjs",