mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 18:26:05 +08:00
fix(nbstore): check before save empty update (#10304)
This commit is contained in:
@@ -437,13 +437,15 @@ export class DocSyncPeer {
|
||||
data.length > 0 ? await this.mergeUpdates(data) : new Uint8Array();
|
||||
|
||||
throwIfAborted(signal);
|
||||
await this.local.pushDocUpdate(
|
||||
{
|
||||
docId,
|
||||
bin: update,
|
||||
},
|
||||
this.uniqueId
|
||||
);
|
||||
if (!isEmptyUpdate(update)) {
|
||||
await this.local.pushDocUpdate(
|
||||
{
|
||||
docId,
|
||||
bin: update,
|
||||
},
|
||||
this.uniqueId
|
||||
);
|
||||
}
|
||||
throwIfAborted(signal);
|
||||
|
||||
await this.syncMetadata.setPeerPulledRemoteClock(this.peerId, {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IndexedDBDocStorage } from '@affine/nbstore/idb';
|
||||
import { SqliteDocStorage } from '@affine/nbstore/sqlite';
|
||||
import { IndexedDBDocStorage, IndexedDBSyncStorage } from '@affine/nbstore/idb';
|
||||
import { SqliteDocStorage, SqliteSyncStorage } from '@affine/nbstore/sqlite';
|
||||
import type { StoreClient } from '@affine/nbstore/worker/client';
|
||||
import { Entity } from '@toeverything/infra';
|
||||
|
||||
@@ -16,6 +16,10 @@ export class UserDBEngine extends Entity<{
|
||||
BUILD_CONFIG.isElectron || BUILD_CONFIG.isIOS
|
||||
? SqliteDocStorage
|
||||
: IndexedDBDocStorage;
|
||||
SyncStorageType =
|
||||
BUILD_CONFIG.isElectron || BUILD_CONFIG.isIOS
|
||||
? SqliteSyncStorage
|
||||
: IndexedDBSyncStorage;
|
||||
|
||||
canGracefulStop() {
|
||||
// TODO(@eyhn): Implement this
|
||||
@@ -40,6 +44,14 @@ export class UserDBEngine extends Entity<{
|
||||
type: 'userspace',
|
||||
},
|
||||
},
|
||||
sync: {
|
||||
name: this.SyncStorageType.identifier,
|
||||
opts: {
|
||||
id: `${serverService.server.id}:` + this.userId,
|
||||
type: 'userspace',
|
||||
flavour: serverService.server.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
remotes: {
|
||||
cloud: {
|
||||
|
||||
Reference in New Issue
Block a user