fix(editor): should not update table selection after table is destroyed (#9665)

This commit is contained in:
zzj3720 committed 2025-01-13 10:43:02 +00:00
1 parent 7e5e6031e8
commit 80f8944188
2 files changed
+9 -2

No files matched your search

@@ -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