Skip to content

Flaky: Inbox request budget sees 3 serial rounds because near-screen link reads start a frame late #4254

Done

Description

@sentry-junior

e2e/inbox/inbox.spec.ts "loads the Inbox within its request budget" (budget { requests: 10, serialRounds: 2 }) sometimes measures 3 serial rounds. It failed 2 of 3 local runs and both CI attempts on #4205 (Blacksmith job 138815975032).

Cause: since #4230, a row reads its link cards only after useNearScreen's IntersectionObserver callback fires (packages/junior-dashboard/src/client/display-text/resolvedObjects.tsx). That callback runs a frame after mount, so the /api/objects read often starts after the row-preview read (/api/conversations/…?limit=1) has finished. The request guard then counts it as a third round. The objects read doesn't depend on the preview, so this is a timing race.

On main the budget test exists only in the classic spec. #4205 moves it into the new UI spec, which is where it shows up.

Fix: set useNearScreen's first near value from a synchronous check on mount (getBoundingClientRect against the scroll parent, with the same 50% margin). On-screen rows then start their link read in the first round, and the observer still handles rows that scroll in later. The budget stays at 10/2.

via @BYK.

--

View Session [Sentry]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions