fix(nbstore): check before save empty update (#10304)

This commit is contained in:
EYHN
2025-02-20 04:24:49 +00:00
parent 1d339c682b
commit 5042d9f644
2 changed files with 23 additions and 9 deletions

View File

@@ -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: {