fix(editor): hook of database is invoked repeatedly (#13493)

Close
[AF-2789](https://linear.app/affine-design/issue/AF-2789/安卓客户端日期没了)

#### PR Dependency Tree


* **PR #13493** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved editing mode stability in mobile Kanban cells by preventing
redundant enter/exit transitions, resulting in smoother interactions and
reduced flicker.
* Enhanced mobile Table cells to avoid duplicate editing state changes,
minimizing unnecessary updates and improving responsiveness.
* Overall, editing transitions are now idempotent across affected mobile
views, reducing visual jitter and improving performance during edit
operations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
L-Sun
2025-08-15 14:09:34 +08:00
committed by GitHub
parent 693ae9c834
commit 0710da15c6
2 changed files with 4 additions and 4 deletions

View File

@@ -103,12 +103,12 @@ export class MobileKanbanCell extends SignalWatcher(
this.disposables.add(
effect(() => {
const isEditing = this.isSelectionEditing$.value;
if (isEditing) {
if (isEditing && !this.isEditing$.peek()) {
this.isEditing$.value = true;
requestAnimationFrame(() => {
this._cell.value?.afterEnterEditingMode();
});
} else {
} else if (!isEditing && this.isEditing$.peek()) {
this._cell.value?.beforeExitEditingMode();
this.isEditing$.value = false;
}

View File

@@ -105,13 +105,13 @@ export class MobileTableCell extends SignalWatcher(
this.disposables.add(
effect(() => {
const isEditing = this.isSelectionEditing$.value;
if (isEditing) {
if (isEditing && !this.isEditing$.peek()) {
this.isEditing$.value = true;
const cell = this._cell.value;
requestAnimationFrame(() => {
cell?.afterEnterEditingMode();
});
} else {
} else if (!isEditing && this.isEditing$.peek()) {
this._cell.value?.beforeExitEditingMode();
this.isEditing$.value = false;
}