fix(core): correctly toggle visibility of starter-bar based on doc.isEmpty (#10439)

This commit is contained in:
CatsJuice
2025-02-26 07:49:50 +00:00
parent 866b096304
commit e1fd8f5d80
4 changed files with 64 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
import { Container, type ServiceProvider } from '@blocksuite/global/di';
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import { type Disposable, Slot } from '@blocksuite/global/utils';
import { signal } from '@preact/signals-core';
import { computed, signal } from '@preact/signals-core';
import type { ExtensionType } from '../../extension/extension.js';
import { StoreSelectionExtension } from '../../extension/index.js';
@@ -55,6 +55,10 @@ export class Store {
private readonly _readonly = signal(false);
private readonly _isEmpty = computed(() => {
return this.root?.isEmpty() ?? true;
});
private readonly _schema: Schema;
readonly slots: Doc['slots'] & {
@@ -215,7 +219,11 @@ export class Store {
}
get isEmpty() {
return this.root?.isEmpty() ?? true;
return this._isEmpty.peek();
}
get isEmpty$() {
return this._isEmpty;
}
get loaded() {