mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-28 12:32:09 +03:00
Merge branch 'feat/cloud-sync-saika' into feat/datacenter
This commit is contained in:
commit
d7e6654965
@ -186,7 +186,7 @@ export class DataCenter {
|
||||
*/
|
||||
public async onWorkspacesChange(
|
||||
callback: (workspaces: WorkspaceUnitCollectionChangeEvent) => void,
|
||||
{ immediate = true }: { immediate?: boolean }
|
||||
{ immediate = true }: { immediate?: boolean } = {}
|
||||
) {
|
||||
if (immediate) {
|
||||
callback({
|
||||
|
@ -16,6 +16,7 @@ import { getApis } from './apis/index.js';
|
||||
import type { Apis, WorkspaceDetail, Callback } from './apis';
|
||||
import { setDefaultAvatar } from '../utils.js';
|
||||
import { MessageCode } from '../../message';
|
||||
import { blob } from 'stream/consumers';
|
||||
|
||||
export interface AffineProviderConstructorParams
|
||||
extends ProviderConstructorParams {
|
||||
@ -348,9 +349,10 @@ export class AffineProvider extends BaseProvider {
|
||||
assert(to.room, 'Blocksuite Workspace without room(workspaceId).');
|
||||
const ws = this._getWebsocketProvider(to);
|
||||
applyUpdate(to.doc, encodeStateAsUpdate(from.doc));
|
||||
// TODO: upload blobs and make sure doc is synced
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
ws.once('synced', () => {
|
||||
resolve();
|
||||
setTimeout(() => resolve(), 1000);
|
||||
});
|
||||
ws.once('lost-connection', () => reject());
|
||||
ws.once('connection-error', () => reject());
|
||||
|
Loading…
Reference in New Issue
Block a user