Skip to content

V2 format check flakes: paginator's debounced afterScroll runs on a destroyed view #1291

Closed

Description

@mrviduus

check:v2-reader-formats (gates the PR) failed 2 of the last 4 runs on branches that do not touch the page (#1288 first run, #1289), and passed on a re-run:

FAIL  clock.runFor: TypeError: Cannot read properties of null (reading 'document')
    at #getVisibleRange
    at #afterScroll
    at later            (the paginator's debounce)
    at ClockController._callFirstTimer

Where: the telemetry rows of formats.check.mjs (fake clock), in the runFor after "the same book reopened". The previous book's paginator still has a debounced #afterScroll pending when its view is destroyed; the fake clock then fires it and this.#view is null.

No failure of this kind before 2026-11-13 (first seen after #1285 and #1287 merged), so something in those made the pending debounce likelier; the race itself is in the fork's paginator.

In a real browser this is an uncaught error in a timer after a book closes: nothing is saved or shown wrong, but it is noise in Sentry and the gate is flaky.

Fix candidates:

Until then a red frontend job with this stack is this flake: re-run the failed job.

Metadata

Metadata

Assignees

No one assigned

    Labels

    reader-enginepackages/reader-engine (ADR-025)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions