Files
amc/dashboard
teernisse ef451cf20f feat(dashboard): add input history navigation with up/down arrows
Add shell-style up/down arrow navigation through past messages in the
SimpleInput component. History is derived from the conversation data
already parsed from session logs — no new state management needed.

dashboard/components/SessionCard.js:
- Pass `conversation` prop through to SimpleInput (line 170)
- Prop chain verified: App -> SessionCard -> SimpleInput, including
  the Modal/enlarged path (Modal.js:69 already passes conversation)

dashboard/components/SimpleInput.js:
- Accept `conversation` prop and derive `userHistory` via useMemo,
  filtering for role === 'user' messages and mapping to content
- Add historyIndexRef (-1 = not browsing) and draftRef (preserves
  in-progress text when entering history mode)
- ArrowUp: intercepts only when cursor at position 0 and autocomplete
  closed, walks backward through history (newest to oldest)
- ArrowDown: only when already browsing history, walks forward;
  past newest entry restores saved draft and exits history mode
- Bounds clamp on ArrowUp prevents undefined array access if
  userHistory shrinks between navigations (SSE update edge case)
- Reset historyIndexRef on submit (line 110) and manual input (line 141)
- Textarea height recalculated after setting history text via
  setTimeout to run after Preact commits the state update

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 14:51:14 -05:00
..