fix(scanner): import useFocusTrap in ScanDisambiguationDialog #144
No reviewers
Labels
No labels
agent-context-drift
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: rstillwell/deckhearth#144
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/scan-disambiguation-missing-import"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Production runtime ReferenceError on the scan flow:
```
ReferenceError: useFocusTrap is not defined
at ScanDisambiguationDialog (...)
at
```
The dialog only renders when OCR returns ambiguous matches, which is why the homepage smoke + visual baselines never caught it — the dialog mount path is reachable only via a real scan-with-multiple-candidates flow.
What
`components/ScanDisambiguationDialog.js` calls `useFocusTrap(...)` on line 14 but never imports it. The file previously had `import { useRef } from 'react'` (unused since PR #67 / `071a3dc` swapped the inline ref-management for the hook). The `useFocusTrap` named import from `lib/use-focus-trap.js` was never added.
```diff
-import { useRef } from 'react';
+import { useFocusTrap } from '../lib/use-focus-trap';
```
Parallel to how `components/ui/Modal.js` imports the OTHER named export (`useFocusTrapContainer`, exposed as the default) — see Modal.js:3 + use-focus-trap.js:21 (`export function useFocusTrap`) / :87 (`export default function useFocusTrapContainer`).
Why didn't lint catch this?
The project's flat ESLint config does NOT extend `@eslint/js`'s `recommended` rule set, so the core `no-undef` rule is OFF. The `eslint-plugin-react` rule `react/jsx-no-undef` only catches undefined JSX components, not plain JS identifier references.
`npx eslint components/ScanDisambiguationDialog.js` against the pre-fix file: 0 problems.
Followup queued: `enable-no-undef-eslint-rule` — add `@eslint/js`'s `recommended` to the flat config (or just enable `no-undef` directly), audit the existing 122-file codebase for false positives (likely few because the rule pairs cleanly with module-scoped imports), and ship. Out of scope for this hotfix to keep the PR diff tight.
Test plan
Made with Cursor
The latest updates on your projects. Learn more about Vercel for GitHub.
Pipeline Health
Build + CI gates
Build runs on Vercel; this CI runs lint and schema-map drift only (no duplicate build).
Role reports
See individual comments above for details. This rollup updates automatically.
Visual Diff
Screenshots and diffs uploaded as artifacts: view run
If intentional changes: update snapshots locally with
npx playwright test --project=visual --update-snapshotsand commit.