toeverything/AFFiNE · error · Error

Method not implemented.

Error message

Method not implemented.

What it means

BlockQueryDataSource.propertyDuplicate is an unimplemented stub: it throws a plain 'Method not implemented.' This data source derives its rows from blocks matching a selector, and its columns from block meta plus user columns; duplicating a column has no defined semantics here, unlike DatabaseBlockDataSource which fully implements propertyDuplicate. Any UI or command that invokes duplicate on a block-query view hits this.

Source

Thrown at blocksuite/affine/blocks/data-view/src/data-source.ts:231

    );
  }

  propertyDataSet(propertyId: string, data: Record<string, unknown>): void {
    const viewColumn = this.getViewColumn(propertyId);
    if (viewColumn) {
      viewColumn.data = data;
    }
  }

  propertyDelete(_id: string): void {
    const index = this.block.props.columns.findIndex(v => v.id === _id);
    if (index >= 0) {
      this.block.props.columns.splice(index, 1);
    }
  }

  propertyDuplicate(_columnId: string): string | undefined {
    throw new Error('Method not implemented.');
  }

  propertyMetaGet(type: string): PropertyMetaConfig {
    const meta = this.columnMetaMap.get(type);
    if (meta) {
      return meta;
    }
    return queryBlockAllColumnMap[type];
  }

  propertyNameGet(propertyId: string): string {
    const viewColumn = this.getViewColumn(propertyId);
    if (viewColumn) {
      return viewColumn.name;
    }
    if (propertyId === 'type') {
      return 'Block Type';
    }

View on GitHub (pinned to 26c515e050)

Solutions

  1. Gate the duplicate-column UI/action on the data source type: disable or hide it for BlockQueryDataSource (check dataSource.meta or the block flavour), enable it only for DatabaseBlockDataSource.
  2. If you need duplication for block-query, implement propertyDuplicate in a subclass following DatabaseBlockDataSource.propertyDuplicate (addProperty + copyCellsByProperty).
  3. Avoid calling generic data-view helpers that assume all DataSourceBase methods are implemented; branch on the concrete data source class.

Example fix

// before
dataSource.propertyDuplicate(columnId); // throws

// after
import type { DatabaseBlockDataSource } from '@blocksuite/affine-block-database';
if (dataSource instanceof DatabaseBlockDataSource) {
  dataSource.propertyDuplicate(columnId);
}
Defensive patterns

Strategy: type-guard

Validate before calling

import type { DataSourceBase } from '@blocksuite/data-view';
import type { DatabaseBlockDataSource } from '@blocksuite/affine-block-database';
function canDuplicate(ds: DataSourceBase): ds is DatabaseBlockDataSource {
  return ds instanceof DatabaseBlockDataSource;
}

Type guard

import { DatabaseBlockDataSource } from '@blocksuite/affine-block-database';
function isDatabaseDataSource(ds: unknown): ds is DatabaseBlockDataSource {
  return ds instanceof DatabaseBlockDataSource;
}

Prevention

When it happens

Trigger: Invoking the 'duplicate property/column' affordance on a DataView block backed by BlockQueryDataSource (data-view block whose dataSource type resolves to block-query). Programmatic calls to dataSource.propertyDuplicate(columnId) on such a source. Calling databaseViewInitTemplate or any generic data-view operation that assumes the full DatabaseBlockDataSource contract.

Common situations: Reusing database-block UI components against a BlockQueryDataSource; rendering a custom view type that exposes a duplicate-column button without gating it on dataSource capabilities; version upgrades that added the duplicate affordance to shared data-view chrome.

Related errors


AI-assisted analysis of toeverything/AFFiNE@26c515e050 (2026-08-12). Data as JSON: /api/errors/75e389824737faf4. Report an issue: GitHub.