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

@@ -115,7 +115,7 @@ const StarterBarNotEmpty = ({ doc }: { doc: Store }) => {
}
return (
<div className={styles.root}>
<div className={styles.root} data-testid="starter-bar">
{t['com.affine.page-starter-bar.start']()}
<ul className={styles.badges}>
{enableAI ? (
@@ -166,12 +166,9 @@ export const StarterBar = ({ doc }: { doc: Store }) => {
);
useEffect(() => {
const disposable = doc.slots.blockUpdated.on(() => {
setIsEmpty(doc.isEmpty);
return doc.isEmpty$.subscribe(value => {
setIsEmpty(value);
});
return () => {
disposable.dispose();
};
}, [doc]);
if (!isEmpty || isTemplate) return null;