mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 20:46:38 +08:00
fix: type import (#2715)
This commit is contained in:
@@ -39,6 +39,7 @@ vi.stubGlobal('window', {
|
||||
},
|
||||
events: {
|
||||
db: {
|
||||
// @ts-expect-error
|
||||
onExternalUpdate: fn => {
|
||||
triggerDBUpdate = fn;
|
||||
return () => {
|
||||
@@ -113,6 +114,7 @@ describe('SQLite download provider', () => {
|
||||
|
||||
offlineYdoc.getText('text').insert(0, 'sqlite-world');
|
||||
|
||||
// @ts-expect-error
|
||||
triggerDBUpdate?.({
|
||||
workspaceId: id + '-another-id',
|
||||
update: Y.encodeStateAsUpdate(offlineYdoc),
|
||||
@@ -121,6 +123,7 @@ describe('SQLite download provider', () => {
|
||||
// not yet updated (because the workspace id is different)
|
||||
expect(workspace.doc.getText('text').toString()).toBe('');
|
||||
|
||||
// @ts-expect-error
|
||||
triggerDBUpdate?.({
|
||||
workspaceId: id,
|
||||
update: Y.encodeStateAsUpdate(offlineYdoc),
|
||||
|
||||
@@ -183,6 +183,7 @@ const createSQLiteProvider = (
|
||||
const connect = () => {
|
||||
logger.info('connecting sqlite provider', blockSuiteWorkspace.id);
|
||||
blockSuiteWorkspace.doc.on('update', handleUpdate);
|
||||
// @ts-expect-error
|
||||
unsubscribe = events.db.onExternalUpdate(({ update, workspaceId }) => {
|
||||
if (workspaceId === blockSuiteWorkspace.id) {
|
||||
Y.applyUpdate(blockSuiteWorkspace.doc, update, sqliteOrigin);
|
||||
|
||||
Reference in New Issue
Block a user