mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-31 09:09:54 +08:00
fix(editor): should not update table selection after table is destroyed (#9665)
This commit is contained in:
@@ -78,7 +78,7 @@ export class SelectGroupView extends BaseGroup<
|
||||
};
|
||||
|
||||
get tag() {
|
||||
return this.data.options.find(v => v.id === this.value);
|
||||
return this.data.options?.find(v => v.id === this.value);
|
||||
}
|
||||
|
||||
protected override render(): unknown {
|
||||
|
||||
@@ -1017,6 +1017,9 @@ export class SelectionElement extends WithDisposable(ShadowlessElement) {
|
||||
this.disposables.add(
|
||||
effect(() => {
|
||||
this.startUpdate(this.selection$.value);
|
||||
return () => {
|
||||
this.cancelSelectionUpdate();
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -1033,11 +1036,15 @@ export class SelectionElement extends WithDisposable(ShadowlessElement) {
|
||||
`;
|
||||
}
|
||||
|
||||
startUpdate(selection?: TableViewSelection) {
|
||||
cancelSelectionUpdate() {
|
||||
if (this.preTask) {
|
||||
cancelAnimationFrame(this.preTask);
|
||||
this.preTask = 0;
|
||||
}
|
||||
}
|
||||
|
||||
startUpdate(selection?: TableViewSelection) {
|
||||
this.cancelSelectionUpdate();
|
||||
if (
|
||||
selection?.selectionType === 'area' &&
|
||||
!this.controller.host.props.view.readonly$.value
|
||||
|
||||
Reference in New Issue
Block a user