toeverything/AFFiNE · warning · BlockSuiteError
DatabaseBlockError
DatabaseBlockError
Error message
Unknown arrow keys, only support: up, down, left, and right keys.
What it means
In the Kanban PC selection controller, the group-navigation method handles 'up'/'down'/'right'/'left' explicitly and throws DatabaseBlockError in the final else branch. It is a defensive guard ensuring only the four arrow directions reach the end.
Source
Thrown at blocksuite/affine/data-view/src/view-presets/kanban/pc/controller/selection.ts:381
if (nextPosition === 'right') {
return getNextGroupFocusElement(
this.host,
groups,
selection,
groupIndex => (groupIndex === groups.length - 1 ? 0 : groupIndex + 1)
);
}
if (nextPosition === 'left') {
return getNextGroupFocusElement(
this.host,
groups,
selection,
groupIndex => (groupIndex === 0 ? groups.length - 1 : groupIndex - 1)
);
}
throw new BlockSuiteError(
ErrorCode.DatabaseBlockError,
'Unknown arrow keys, only support: up, down, left, and right keys.'
);
}
getNextFocusCell(
selection: KanbanCellSelection,
index: number,
nextPosition: 'up' | 'down' | 'left' | 'right'
):
| {
cell: KanbanCell;
cardId?: string;
groupKey?: string;
}
| undefined {
const host = this.host;
if (!host) {View on GitHub (pinned to 26c515e050)
Solutions
- Treat this as an unreachable branch per the typed union; if hit, fix the caller passing an invalid direction.
- Extend the union and add handling before this throw if a new direction is introduced.
Defensive patterns
Strategy: type-guard
Type guard
const isArrowDir = (d: string): d is 'up'|'down'|'left'|'right' => d === 'up' || d === 'down' || d === 'left' || d === 'right';
Prevention
- Rely on the typed union to make this branch unreachable
- If hit at runtime, fix the caller passing an invalid direction
When it happens
Trigger: Calling the method with a nextPosition value outside the 'up'|'down'|'left'|'right' union — possible only via a typing escape or a future direction constant.
Common situations: TypeScript should prevent this at compile time; at runtime it indicates an unhandled direction enum or a cast bypassing the type.
Related errors
- DatabaseBlockError
- DatabaseBlockError
- ErrorCode.InlineEditorError
- ErrorCode.TransformerError
- ErrorCode.SelectionError
AI-assisted analysis of toeverything/AFFiNE@26c515e050 (2026-08-12).
Data as JSON: /api/errors/eecfe0d617dbccec.
Report an issue: GitHub.