[Bug] useLabelKeyboard wired but labels array is empty — hotkeys do not trigger labels #2

Closed
opened 2026-03-04 09:29:56 -08:00 by pyr0ball · 0 comments
Owner

Problem

useLabelKeyboard is called in LabelView.vue but receives an empty labels: [] array:

useLabelKeyboard({
  labels: [],   // ← never populated
  onLabel: ...
})

The composable maps number keys 1-9 to label names by index. With an empty array, pressing 1-9 does nothing.

Fix

Pass labels.value (the fetched labels list) instead of a hardcoded empty array:

useLabelKeyboard({
  labels: labels.value,
  onLabel: (name) => handleLabel(name),
  onSkip: () => handleSkip(),
  onDiscard: () => handleDiscard(),
  onUndo: () => handleUndo(),
  onHelp: () => { /* TODO */ },
})

Note: labels is a ref<string[]> fetched from GET /api/config/labels on mount. The composable call needs to either watch the ref or be called after fetch completes.

Acceptance Criteria

  • Pressing 1-9 maps to the corresponding label in the fetched list
  • h skips, S → skip, D → discard, U → undo all work as documented
## Problem `useLabelKeyboard` is called in `LabelView.vue` but receives an empty `labels: []` array: ```ts useLabelKeyboard({ labels: [], // ← never populated onLabel: ... }) ``` The composable maps number keys 1-9 to label names by index. With an empty array, pressing 1-9 does nothing. ## Fix Pass `labels.value` (the fetched labels list) instead of a hardcoded empty array: ```ts useLabelKeyboard({ labels: labels.value, onLabel: (name) => handleLabel(name), onSkip: () => handleSkip(), onDiscard: () => handleDiscard(), onUndo: () => handleUndo(), onHelp: () => { /* TODO */ }, }) ``` Note: `labels` is a `ref<string[]>` fetched from `GET /api/config/labels` on mount. The composable call needs to either watch the ref or be called after fetch completes. ## Acceptance Criteria - Pressing `1`-`9` maps to the corresponding label in the fetched list - `h` skips, `S` → skip, `D` → discard, `U` → undo all work as documented
pyr0ball added the
bug
label 2026-03-14 16:46:15 -07:00
pyr0ball added this to the Alpha — Label Tool milestone 2026-03-14 16:46:17 -07:00
pyr0ball added this to the The Menagerie project 2026-03-14 16:46:20 -07:00
pyr0ball self-assigned this 2026-03-14 16:46:21 -07:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/avocet#2
No description provided.