structuredClone old prop val

This commit is contained in:
Rolands 2026-01-07 11:58:57 +02:00
parent 3686f5818d
commit ca5dd88fcb
3 changed files with 4 additions and 6 deletions

View file

@ -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.

View file

@ -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",

View file

@ -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",