Skip to content

Fix added-page blue border after page deletion remaps page numbers #410

@linear

Description

@linear

Problem

In the PDF viewer, newly added pages get a blue unread/recently-added border so users can tell which pages were added and still need attention.

Bug scenario:

  1. Add a new page to an existing packet.
  2. The added page is classified and shown as page 9 with the blue border.
  3. Delete an earlier page, such as page 7.
  4. The added page shifts from page 9 to page 8, but the blue border stays on page 9.

Root cause

The remove-pages flow already builds an old-to-new page map and remaps page-keyed state such as classifications, requirements, critical values, comments, and Document Intelligence data. The unreadAddedPages set was not included in that remap, so it kept stale page numbers after deletion.

Fix

Remap unreadAddedPages through the same old-to-new page map when pages are deleted. Drop unread markers for pages that were deleted.

Implementation

PR: https://github.com/bild-engineering/bild-ia/pull/296

Files:

  • classify_documents/document-review-tool/src/components/PDFViewer.tsx
  • classify_documents/document-review-tool/src/utils/addedPageUnreadState.ts
  • classify_documents/document-review-tool/tests/unit/addedPageUnreadState.test.ts

Verification

Local checks passed before merge:

  • npm test -- tests/unit/addedPageUnreadState.test.ts src/components/EvaluateMode.layout.test.tsx
  • npx eslint src/utils/addedPageUnreadState.ts tests/unit/addedPageUnreadState.test.ts
  • npm run build

Deployment verification after merge:

  • PR Critical value bbox shows red when correct #296 merged to develop as 06fba6e7ebb4cc153e0bbe7311b47d8e716f1535.
  • BJ test SWA deployed successfully: gray-ground-05374a310.6.azurestaticapps.net.
  • OP test SWA deployed successfully: yellow-desert-0e9ef690f.6.azurestaticapps.net.
  • Both Azure Static Web Apps default environments are Ready on sourceBranch: develop.

Acceptance criteria

  • Add a page and confirm the blue border appears on the added page.
  • Delete an earlier page.
  • Confirm the blue border moves with the added page after page numbers shift.
  • Confirm deleting the added page removes its unread marker instead of leaving a stale border on another page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions