@nxtedition/deepstream.io-client-js 23.4.47 → 23.4.48

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/deepstream.io-client-js",
3
- "version": "23.4.47",
3
+ "version": "23.4.48",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "bugs": {
@@ -85,12 +85,15 @@ class RecordHandler {
85
85
  }
86
86
 
87
87
  _onState(rec, prevState) {
88
- // TODO (perf): avoid pending.has
89
- if (rec.state < Record.STATE.SERVER && !this._pending.has(rec)) {
90
- this._pending.add(rec)
88
+ if (
89
+ rec.state < Record.STATE.SERVER &&
90
+ (prevState === Record.STATE.INIT || prevState >= Record.STATE.SERVER)
91
+ ) {
91
92
  rec.ref()
92
- } else if (this._pending.delete(rec)) {
93
+ this._pending.add(rec)
94
+ } else if (prevState >= Record.STATE.SERVER) {
93
95
  rec.unref()
96
+ this._pending.delete(rec)
94
97
  }
95
98
  }
96
99
 
@@ -175,15 +178,11 @@ class RecordHandler {
175
178
  }
176
179
  }
177
180
 
178
- const xs = new Set()
179
-
180
181
  const onUpdate = (rec) => {
181
182
  if (rec.state < C.RECORD_STATE.SERVER) {
182
183
  return
183
184
  }
184
185
 
185
- xs.delete(rec.name)
186
-
187
186
  rec.unsubscribe(onUpdate)
188
187
  rec.unref()
189
188
  counter -= 1
@@ -193,7 +192,6 @@ class RecordHandler {
193
192
 
194
193
  for (const rec of this._pending) {
195
194
  if (rec.state < C.RECORD_STATE.SERVER) {
196
- xs.add(rec.name)
197
195
  rec.subscribe(onUpdate)
198
196
  rec.ref()
199
197
  counter += 1