fix(editor): clicking the sorting button results in an error (#10800)

This commit is contained in:
zzj3720
2025-03-13 03:17:48 +00:00
parent 86729fb447
commit f6a62fa737
3 changed files with 5 additions and 10 deletions

View File

@@ -63,9 +63,7 @@ export class DataViewRenderer extends SignalWatcher(
} }
`; `;
private readonly _view = signal<{ private readonly _view = signal<DataViewInstance>();
expose: DataViewInstance;
}>();
@property({ attribute: false }) @property({ attribute: false })
accessor config!: DataViewRendererConfig; accessor config!: DataViewRendererConfig;
@@ -121,7 +119,7 @@ export class DataViewRenderer extends SignalWatcher(
}); });
focusFirstCell = () => { focusFirstCell = () => {
this.view?.expose.focusFirstCell(); this.view?.focusFirstCell();
}; };
openDetailPanel = (ops: { openDetailPanel = (ops: {
@@ -224,7 +222,7 @@ export class DataView {
private readonly _ref = createRef<DataViewRenderer>(); private readonly _ref = createRef<DataViewRenderer>();
get expose() { get expose() {
return this._ref.value?.view?.expose; return this._ref.value?.view;
} }
render(props: DataViewRendererConfig) { render(props: DataViewRendererConfig) {

View File

@@ -44,9 +44,7 @@ type DataViewComponent = UniComponent<
{ {
props: DataViewProps; props: DataViewProps;
}, },
{ DataViewInstance
expose: DataViewInstance;
}
>; >;
export interface DataViewRendererConfig { export interface DataViewRendererConfig {

View File

@@ -169,8 +169,7 @@ export class DatabaseHeaderColumn extends SignalWatcher(
const sortUtils = createSortUtils( const sortUtils = createSortUtils(
sortTrait, sortTrait,
this.closest('affine-data-view-renderer')?.view?.expose.eventTrace ?? this.closest('affine-data-view-renderer')?.view?.eventTrace ?? (() => {})
(() => {})
); );
const sortList = sortUtils.sortList$.value; const sortList = sortUtils.sortList$.value;
const existingIndex = sortList.findIndex( const existingIndex = sortList.findIndex(