@pluv/client 0.38.13 → 0.38.14

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/client@0.38.13 build /home/runner/work/pluv/pluv/packages/client
2
+ > @pluv/client@0.38.14 build /home/runner/work/pluv/pluv/packages/client
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 49.38 KB
12
- CJS ⚡️ Build success in 94ms
13
- ESM dist/index.mjs 48.06 KB
14
- ESM ⚡️ Build success in 102ms
11
+ CJS dist/index.js 49.20 KB
12
+ CJS ⚡️ Build success in 128ms
13
+ ESM dist/index.mjs 47.88 KB
14
+ ESM ⚡️ Build success in 134ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3308ms
16
+ DTS ⚡️ Build success in 3169ms
17
17
  DTS dist/index.d.mts 23.23 KB
18
18
  DTS dist/index.d.ts 23.23 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @pluv/client
2
2
 
3
+ ## 0.38.14
4
+
5
+ ### Patch Changes
6
+
7
+ - 886a1f9: Fix cases where the user's own presence was getting updated excessively, and without re-triggering subscriptions.
8
+ - @pluv/crdt@0.38.14
9
+ - @pluv/types@0.38.14
10
+
3
11
  ## 0.38.13
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -347,9 +347,7 @@ var UsersManager = class {
347
347
  patchPresence(connectionId, patch) {
348
348
  var _a, _b;
349
349
  if (((_a = this._myself) == null ? void 0 : _a.connectionId) === connectionId) {
350
- const presence2 = __spreadValues(__spreadValues({}, this._myPresence), patch);
351
- this._myself.presence = presence2;
352
- this._myPresence = presence2;
350
+ this.updateMyPresence(patch);
353
351
  return;
354
352
  }
355
353
  const other = this._others.get(connectionId);
@@ -400,8 +398,8 @@ var UsersManager = class {
400
398
  /**
401
399
  * @description This method need not care about being connected.
402
400
  */
403
- updateMyPresence(presence) {
404
- this._myPresence = __spreadValues(__spreadValues({}, this._myPresence), presence);
401
+ updateMyPresence(patch) {
402
+ this._myPresence = __spreadValues(__spreadValues({}, this._myPresence), patch);
405
403
  if (!this._myself) return;
406
404
  this._myself.presence = this._myPresence;
407
405
  }
@@ -874,10 +872,9 @@ var PluvRoom = class extends AbstractRoom {
874
872
  if (!connectionId) return;
875
873
  if (!this._state.webSocket) throw new Error("Could not find WebSocket");
876
874
  const data = message.data;
877
- this._usersManager.patchPresence(connectionId, data.presence);
878
- const myPresence = this._usersManager.myPresence;
879
875
  const myself = (_a = this._usersManager.myself) != null ? _a : null;
880
876
  if ((myself == null ? void 0 : myself.connectionId) === connectionId) return;
877
+ this._usersManager.patchPresence(connectionId, data.presence);
881
878
  const other = this._usersManager.getOther(connectionId);
882
879
  const others = this._usersManager.getOthers();
883
880
  this._otherNotifier.subject(connectionId).next(other);
package/dist/index.mjs CHANGED
@@ -316,9 +316,7 @@ var UsersManager = class {
316
316
  patchPresence(connectionId, patch) {
317
317
  var _a, _b;
318
318
  if (((_a = this._myself) == null ? void 0 : _a.connectionId) === connectionId) {
319
- const presence2 = __spreadValues(__spreadValues({}, this._myPresence), patch);
320
- this._myself.presence = presence2;
321
- this._myPresence = presence2;
319
+ this.updateMyPresence(patch);
322
320
  return;
323
321
  }
324
322
  const other = this._others.get(connectionId);
@@ -369,8 +367,8 @@ var UsersManager = class {
369
367
  /**
370
368
  * @description This method need not care about being connected.
371
369
  */
372
- updateMyPresence(presence) {
373
- this._myPresence = __spreadValues(__spreadValues({}, this._myPresence), presence);
370
+ updateMyPresence(patch) {
371
+ this._myPresence = __spreadValues(__spreadValues({}, this._myPresence), patch);
374
372
  if (!this._myself) return;
375
373
  this._myself.presence = this._myPresence;
376
374
  }
@@ -843,10 +841,9 @@ var PluvRoom = class extends AbstractRoom {
843
841
  if (!connectionId) return;
844
842
  if (!this._state.webSocket) throw new Error("Could not find WebSocket");
845
843
  const data = message.data;
846
- this._usersManager.patchPresence(connectionId, data.presence);
847
- const myPresence = this._usersManager.myPresence;
848
844
  const myself = (_a = this._usersManager.myself) != null ? _a : null;
849
845
  if ((myself == null ? void 0 : myself.connectionId) === connectionId) return;
846
+ this._usersManager.patchPresence(connectionId, data.presence);
850
847
  const other = this._usersManager.getOther(connectionId);
851
848
  const others = this._usersManager.getOthers();
852
849
  this._otherNotifier.subject(connectionId).next(other);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/client",
3
- "version": "0.38.13",
3
+ "version": "0.38.14",
4
4
  "description": "@pluv/io frontend client",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "wonka": "^6.3.5",
21
- "@pluv/crdt": "^0.38.13",
22
- "@pluv/types": "^0.38.13"
21
+ "@pluv/crdt": "^0.38.14",
22
+ "@pluv/types": "^0.38.14"
23
23
  },
24
24
  "devDependencies": {
25
25
  "eslint": "^8.57.1",
26
26
  "tsup": "^8.4.0",
27
27
  "typescript": "^5.8.3",
28
- "@pluv/tsconfig": "^0.38.13",
29
- "eslint-config-pluv": "^0.38.13"
28
+ "@pluv/tsconfig": "^0.38.14",
29
+ "eslint-config-pluv": "^0.38.14"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/PluvRoom.ts CHANGED
@@ -785,9 +785,6 @@ export class PluvRoom<
785
785
 
786
786
  const data = message.data as BaseIOEventRecord<InferIOAuthorize<TIO>>["$presenceUpdated"];
787
787
 
788
- this._usersManager.patchPresence(connectionId, data.presence as TPresence);
789
-
790
- const myPresence = this._usersManager.myPresence;
791
788
  const myself = this._usersManager.myself ?? null;
792
789
 
793
790
  /**
@@ -799,6 +796,8 @@ export class PluvRoom<
799
796
  */
800
797
  if (myself?.connectionId === connectionId) return;
801
798
 
799
+ this._usersManager.patchPresence(connectionId, data.presence as TPresence);
800
+
802
801
  const other = this._usersManager.getOther(connectionId);
803
802
  const others = this._usersManager.getOthers();
804
803
 
@@ -52,13 +52,7 @@ export class UsersManager<TIO extends IOLike, TPresence extends JsonObject = {}>
52
52
 
53
53
  public patchPresence(connectionId: string, patch: Partial<TPresence>): void {
54
54
  if (this._myself?.connectionId === connectionId) {
55
- const presence = {
56
- ...this._myPresence,
57
- ...patch,
58
- } as TPresence;
59
-
60
- this._myself.presence = presence;
61
- this._myPresence = presence;
55
+ this.updateMyPresence(patch);
62
56
 
63
57
  return;
64
58
  }
@@ -135,8 +129,8 @@ export class UsersManager<TIO extends IOLike, TPresence extends JsonObject = {}>
135
129
  /**
136
130
  * @description This method need not care about being connected.
137
131
  */
138
- public updateMyPresence(presence: Partial<TPresence>): void {
139
- this._myPresence = { ...this._myPresence, ...presence };
132
+ public updateMyPresence(patch: Partial<TPresence>): void {
133
+ this._myPresence = { ...this._myPresence, ...patch };
140
134
 
141
135
  if (!this._myself) return;
142
136