@cuboapp/crdt 1.0.18 → 1.0.19

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": "@cuboapp/crdt",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "CRDT for CUBO",
5
5
  "main": "src/index.ts",
6
6
  "repository": {
@@ -64,7 +64,9 @@ export class CuboCrdtServerDocument {
64
64
  const body = pick(row, origin.keys ?? Object.keys(row))
65
65
 
66
66
  if (Object.keys(body).length) {
67
- this.debounceStore(body, origin)
67
+ this.debounceStore(body, origin).catch((error) => {
68
+ console.error('[CRDT] store document', this.name, error)
69
+ })
68
70
  }
69
71
  }
70
72
  })
@@ -102,7 +104,7 @@ export class CuboCrdtServerDocument {
102
104
  this.persistedState = cloneDeep(row)
103
105
  }
104
106
 
105
- async write(dto: object, origin?: CuboCrdtServerDocumentOrigin) {
107
+ write(dto: object, origin?: CuboCrdtServerDocumentOrigin) {
106
108
  const map = this.getMap()
107
109
 
108
110
  // Пропускаем скалярные ключи с тем же значением: Y.Map.set всегда создаёт новый Item и
@@ -138,5 +140,6 @@ export class CuboCrdtServerDocument {
138
140
  await this.opts?.onStore?.(body, origin, { previousRow, row })
139
141
  this.setPersistedState(row)
140
142
  }
143
+
141
144
  public debounceStore = debounce(this.store.bind(this), 300)
142
145
  }