mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
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:
@@ -103,12 +103,12 @@ export class MobileKanbanCell extends SignalWatcher(
|
|||||||
this.disposables.add(
|
this.disposables.add(
|
||||||
effect(() => {
|
effect(() => {
|
||||||
const isEditing = this.isSelectionEditing$.value;
|
const isEditing = this.isSelectionEditing$.value;
|
||||||
if (isEditing) {
|
if (isEditing && !this.isEditing$.peek()) {
|
||||||
this.isEditing$.value = true;
|
this.isEditing$.value = true;
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
this._cell.value?.afterEnterEditingMode();
|
this._cell.value?.afterEnterEditingMode();
|
||||||
});
|
});
|
||||||
} else {
|
} else if (!isEditing && this.isEditing$.peek()) {
|
||||||
this._cell.value?.beforeExitEditingMode();
|
this._cell.value?.beforeExitEditingMode();
|
||||||
this.isEditing$.value = false;
|
this.isEditing$.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,13 +105,13 @@ export class MobileTableCell extends SignalWatcher(
|
|||||||
this.disposables.add(
|
this.disposables.add(
|
||||||
effect(() => {
|
effect(() => {
|
||||||
const isEditing = this.isSelectionEditing$.value;
|
const isEditing = this.isSelectionEditing$.value;
|
||||||
if (isEditing) {
|
if (isEditing && !this.isEditing$.peek()) {
|
||||||
this.isEditing$.value = true;
|
this.isEditing$.value = true;
|
||||||
const cell = this._cell.value;
|
const cell = this._cell.value;
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
cell?.afterEnterEditingMode();
|
cell?.afterEnterEditingMode();
|
||||||
});
|
});
|
||||||
} else {
|
} else if (!isEditing && this.isEditing$.peek()) {
|
||||||
this._cell.value?.beforeExitEditingMode();
|
this._cell.value?.beforeExitEditingMode();
|
||||||
this.isEditing$.value = false;
|
this.isEditing$.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user