From ca5dd88fcb141049f140d862ac725a39a14f6395 Mon Sep 17 00:00:00 2001 From: Rolands Date: Wed, 7 Jan 2026 11:58:57 +0200 Subject: [PATCH] structuredClone old prop val --- core/core-server.ts | 4 +--- core/package-lock.json | 4 ++-- core/package.json | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/core-server.ts b/core/core-server.ts index c293d78..4306a39 100644 --- a/core/core-server.ts +++ b/core/core-server.ts @@ -887,9 +887,7 @@ export class SocioServer extends LogHandler { const prop = this.#props.get(key); if (!prop) throw new E(`Prop key [${key}] not registered! [#prop-update-not-found]`); - const old_prop_val = prop.val; //bcs the assigner somehow changes this property. Weird. - //Dont think JS allows such ref pointers to work. But this then keeps the correct val. - //This idea works bcs the mutator of the data should be the first to run this and all other session will get informed here with that sessions diff. + const old_prop_val = structuredClone(prop.val); //bcs the assigner changes this property. if (prop.assigner(key, new_val, sender_client_id ? this.#sessions.get(sender_client_id) : undefined)) {//if the prop was passed and the value was set successfully, then update all the subscriptions const new_assigned_prop_val = this.GetPropVal(key); //should be GetPropVal, bcs i cant know how the assigner changed the val. But since it runs once per update, then i can cache this call here right after the assigner. diff --git a/core/package-lock.json b/core/package-lock.json index cd3ba37..96a4daa 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -1,12 +1,12 @@ { "name": "socio", - "version": "1.15.10", + "version": "1.15.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "socio", - "version": "1.15.10", + "version": "1.15.11", "license": "MIT", "dependencies": { "@msgpack/msgpack": "^3.1.2", diff --git a/core/package.json b/core/package.json index 1d680ec..d074a1b 100644 --- a/core/package.json +++ b/core/package.json @@ -1,6 +1,6 @@ { "name": "socio", - "version": "1.15.10", + "version": "1.15.11", "description": "A WebSocket Real-Time Communication (RTC) API framework.", "main": "./dist/core.js", "type": "module",