mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-03 02:20:19 +08:00
chore: prohibit using mergeUpdates (#3701)
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
import type { IDBPDatabase } from 'idb';
|
||||
import { openDB } from 'idb';
|
||||
import { mergeUpdates } from 'yjs';
|
||||
import { applyUpdate, Doc, encodeStateAsUpdate } from 'yjs';
|
||||
|
||||
import type { BlockSuiteBinaryDB, OldYjsDB, UpdateMessage } from './shared';
|
||||
import { dbVersion, DEFAULT_DB_NAME, upgradeDB } from './shared';
|
||||
|
||||
let allDb: IDBDatabaseInfo[];
|
||||
|
||||
export function mergeUpdates(updates: Uint8Array[]) {
|
||||
const doc = new Doc();
|
||||
updates.forEach(update => {
|
||||
applyUpdate(doc, update);
|
||||
});
|
||||
return encodeStateAsUpdate(doc);
|
||||
}
|
||||
|
||||
async function databaseExists(name: string): Promise<boolean> {
|
||||
return new Promise(resolve => {
|
||||
const req = indexedDB.open(name);
|
||||
|
||||
Reference in New Issue
Block a user