From 5c73fc9767324a99e852fcf68b0d8aa789878e7a Mon Sep 17 00:00:00 2001 From: L-Sun Date: Wed, 13 Aug 2025 14:33:38 +0800 Subject: [PATCH] chore(editor): adjust notification of database editing (#13484) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### PR Dependency Tree * **PR #13484** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) ## Summary by CodeRabbit - Bug Fixes - Reduced repeated mobile editing notifications; the notice now appears once and only reappears after you dismiss it. - More consistent notification behavior on mobile for a less disruptive editing experience. - Refactor - Streamlined internal event handling to improve reliability and reduce potential listener leaks, resulting in smoother interactions. --- .../affine/blocks/database/src/database-block.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/blocksuite/affine/blocks/database/src/database-block.ts b/blocksuite/affine/blocks/database/src/database-block.ts index 45c763d80..952a76e39 100644 --- a/blocksuite/affine/blocks/database/src/database-block.ts +++ b/blocksuite/affine/blocks/database/src/database-block.ts @@ -372,6 +372,7 @@ export class DatabaseBlockComponent extends CaptionedBlockComponent { if ( !this.std @@ -379,7 +380,8 @@ export class DatabaseBlockComponent extends CaptionedBlockComponent`, accent: 'warning', + onClose: () => { + notifyClosed = true; + }, }); } - this.removeEventListener('click', handler); } }; - this.addEventListener('click', handler); - this.disposables.add(() => { - this.removeEventListener('click', handler); - }); + this.disposables.addFromEvent(this, 'click', handler); } private readonly dataViewRootLogic = lazy(