fix: types; empty check

This commit is contained in:
alt0 2023-01-09 20:48:50 +08:00
parent ee8da42c41
commit 72a39f67c0
2 changed files with 2 additions and 2 deletions

View File

@ -63,7 +63,7 @@ export class AffineProvider extends BaseProvider {
assert(room);
this.linkLocal(workspace);
const updates = await this._apis.downloadWorkspace(room);
if (updates) {
if (updates && updates.byteLength) {
await new Promise(resolve => {
doc.once('update', resolve);
applyUpdate(doc, new Uint8Array(updates));

View File

@ -7,7 +7,7 @@ import * as workspace from './workspace.js';
import { token } from './token.js';
export type Apis = typeof user &
typeof workspace & {
Omit<typeof workspace, 'WorkspaceType' | 'PermissionType'> & {
signInWithGoogle: ReturnType<typeof getAuthorizer>[0];
onAuthStateChanged: ReturnType<typeof getAuthorizer>[1];
} & { token: typeof token };