fix(core): warning when open center peek (#8819)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { DebugLogger } from '@affine/debug';
|
||||||
import { Unreachable } from '@affine/env/constant';
|
import { Unreachable } from '@affine/env/constant';
|
||||||
import {
|
import {
|
||||||
type AffineTextAttributes,
|
type AffineTextAttributes,
|
||||||
@@ -16,6 +17,8 @@ import { DocScope } from '../scopes/doc';
|
|||||||
import type { DocsStore } from '../stores/docs';
|
import type { DocsStore } from '../stores/docs';
|
||||||
import { DocService } from './doc';
|
import { DocService } from './doc';
|
||||||
|
|
||||||
|
const logger = new DebugLogger('DocsService');
|
||||||
|
|
||||||
export class DocsService extends Service {
|
export class DocsService extends Service {
|
||||||
list = this.framework.createEntity(DocRecordList);
|
list = this.framework.createEntity(DocRecordList);
|
||||||
|
|
||||||
@@ -52,6 +55,15 @@ export class DocsService extends Service {
|
|||||||
record: docRecord,
|
record: docRecord,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
blockSuiteDoc.load();
|
||||||
|
} catch (e) {
|
||||||
|
logger.error('Failed to load doc', {
|
||||||
|
docId,
|
||||||
|
error: e,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const doc = docScope.get(DocService).doc;
|
const doc = docScope.get(DocService).doc;
|
||||||
|
|
||||||
const { obj, release } = this.pool.put(docId, doc);
|
const { obj, release } = this.pool.put(docId, doc);
|
||||||
|
|||||||
@@ -32,10 +32,6 @@ export type EditorProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function usePageRoot(page: Doc) {
|
function usePageRoot(page: Doc) {
|
||||||
if (!page.ready) {
|
|
||||||
page.load();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!page.root) {
|
if (!page.root) {
|
||||||
use(
|
use(
|
||||||
new Promise<void>((resolve, reject) => {
|
new Promise<void>((resolve, reject) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user