Skip to content

Document viewer nav #4: Unify Controls and usePageFind to eliminate duplicated find/step logic #668

@hoyla

Description

@hoyla

Something to revisit in the document viewer work

`Controls.tsx` and `usePageFind.ts` both independently manage highlight state (focused index, highlights array, pending state) and implement the same fetch-then-step-through pattern. `Controls` always hits `/search`, `usePageFind` always hits `/find`.

Recommendation: Consolidate into a single shared hook parameterised by endpoint, removing the duplication. This is closely related to #669 (search vs find endpoint clarification).

Files involved:

  • `frontend/src/js/components/PageViewer/Controls.tsx`
  • `frontend/src/js/components/PageViewer/usePageFind.ts`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions