Skip to content

Stabilize inline visualization loading skeleton - #1555

Closed
brsbl wants to merge 1 commit into
mainfrom
bb/fix-inline-vis-jitter-nightly-thr_g3y2kuichb
Closed

brsbl wants to merge 1 commit into
mainfrom
bb/fix-inline-vis-jitter-nightly-thr_g3y2kuichb

Conversation

@brsbl

@brsbl brsbl commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The compact inline-visualization loading state could be replaced by a full-height iframe, changing the timeline layout after navigation. Render a complete six-region skeleton immediately and reserve the preview height through the loading-to-iframe transition.

The skeleton uses shimmer-only paint animation, avoiding staged layout or entrance animation.

Changed files

  • plugins/inline-vis/app.tsx — fixed-height loading container and six-region skeleton.
  • plugins/inline-vis/app.test.tsx — focused regression coverage for the skeleton structure, reserved height, and shimmer-only behavior.

Validation

  • The new regression test asserts all six regions render immediately, excludes staged/pulse animation classes, and preserves the requested height when the iframe replaces the loader.
  • Tests, typecheck, and real-UI responsive/shimmer-cycle results are not asserted here because their originating-thread artifacts were not independently verifiable from this remote branch.

Fixes #1837

BB-Thread-ID: thr_g3y2kuichb

AGENT GENERATED: by GPT-5.6-Terra

SawyerHood added a commit that referenced this pull request Aug 21, 2026
## What was wrong

`InlineVisDirective` in `plugins/inline-vis/app.tsx` starts in `loading`
and stays there until the `prepareHtmlPreview` RPC resolves. The loading
branch rendered a bare one-line "Loading visualization…" box with no
height (37px in the app). The ready branch renders a header plus an
iframe whose inline height comes from the directive's `height` attribute
(default 224px, min 120px). The card therefore grew by hundreds of
pixels in one React commit (measured 37px -> 515px for `height="480"`).
The thread timeline is bottom-anchored, so that growth scrolled every
earlier message upward on every mount of the directive, not only on cold
loads. The preview height is known synchronously from the attributes, so
the final geometry was knowable in the loading state; it just was not
used.

Issue: #1837. Report: https://get-bb.github.io/reports/issues/1837.html

## What changed

- `plugins/inline-vis/app.tsx`: extracted the card chrome (outer card +
header row) into a small `PreviewCard` so the loading and ready states
cannot drift. The loading branch now renders that card with a `size-5`
spacer where the open-in-sidebar button goes, and a `role="status"` /
`aria-busy` / `aria-label="Loading visualization <file>"` container with
`style.height = previewHeight` holding a plain `<Skeleton
className="size-full" />` from `@bb/shared-ui/skeleton`. The ready
branch is unchanged except for using `PreviewCard`.
- `plugins/inline-vis/app.test.tsx`: new test pins the behaviour (loader
height equals the iframe height, same card/header classes, status role
and label); the existing sandbox test now finds the loader by role
instead of the removed text.
- Error, missing-file, and invalid-height branches still render compact
alerts; loading -> error shrinks the card, which is acceptable for an
error path and out of scope here.
- No server, wire, CLI, or doc changes. App-side plugin UI only.

Relation to #1555: that PR also reserves the height, but it duplicates
the header markup, uses `.animate-shine-icon` inside an `aria-hidden`
grid, which `theme.css` pauses since #1880 (so its advertised shimmer is
frozen in the app), and its ~100-line test pins data attributes and
class names rather than behaviour. It also predates #2140, which removed
the `PrepareHtmlPreviewRpcResult` type it touches. This PR is the
~20-line version the report recommends: shared header, fixed-height
`Skeleton` with its built-in pulse (verified running in the app), and a
behaviour-only test.

## How you verified

- New test fails on `origin/main` `app.tsx` (`git checkout origin/main
-- plugins/inline-vis/app.tsx`, then `pnpm exec vitest run app.test.tsx`
in `plugins/inline-vis`):
  ```
× reserves the preview height while loading so the timeline does not
jump
  AssertionError: expected '' to be '480px' // Object.is equality
  ```
- On this branch, from the committed tree (`git status --porcelain`
empty): `pnpm exec turbo run typecheck test
--filter=bb-plugin-inline-vis --force` -> `Tasks: 6 successful, 6
total`, `Tests 17 passed (17)`.
- Manual repro in a dev instance (`scripts/bb-dev-app current`,
claude-code turn that replied with `::inline-vis{file="demo.html"
height="480"}`), holding the `prepareHtmlPreview` request in headless
Chrome and measuring the card before and after release:
- main `app.tsx`: loading `boxHeight: 37` -> ready `boxHeight: 515`,
`deltaHeight: 478`; the user message above moved from `top: 75` to `top:
17`.
- this branch: loading `boxHeight: 515` -> ready `boxHeight: 515`,
`deltaHeight: 0`; user message stays at `top: 17`; skeleton
`animationName: pulse`, `playState: running`.

Fixes #1837

> AGENT GENERATED: by Claude Opus 5


## Independent verification

Checked out `140e23e7f` (`git fetch origin
bb/fix-1837-inline-vis-layout-jump && git checkout -b verify-1837-r1
FETCH_HEAD`); `origin/main` is an ancestor, GitHub reports `MERGEABLE`.
Diff: `plugins/inline-vis/app.tsx` + `plugins/inline-vis/app.test.tsx`
only, +117/-17.

Fail-before: `git checkout origin/main -- plugins/inline-vis/app.tsx`,
then `pnpm exec vitest run app.test.tsx` in `plugins/inline-vis`:

```
FAIL app.test.tsx > InlineVisDirective > reserves the preview height while loading so the timeline does not jump
AssertionError: expected '' to be '480px' // Object.is equality
Tests  2 failed | 5 passed (7)
```

(The second failure is the existing sandbox test, which now looks the
loader up by `role="status"` name.)

Pass-after: restored `app.tsx` from the PR head (`git status
--porcelain` empty), `pnpm exec vitest run app.test.tsx` -> `Tests 7
passed (7)`. `pnpm exec turbo run typecheck test
--filter=bb-plugin-inline-vis --force` -> `Tasks: 6 successful, 6
total`, `Tests 17 passed (17)`.

Repro on the fixed branch: own dev instance (`scripts/bb-dev-app
current`, app :13647 / server :21647), scratch project with `demo.html`,
real claude-code turn replying `::inline-vis{file="demo.html"
height="480"}`. Headless Chrome via doobie held the `prepareHtmlPreview`
RPC, measured the card, released it, measured again:

```
before: state=loading cardHeight=515 innerHeight=480 userMsgTop=17 role=status label="Loading visualization demo.html" skeleton animation=pulse playState=running
after:  state=ready   cardHeight=515 innerHeight=480 userMsgTop=17
deltaHeight: 0, userMsgShift: 0
```

The report measured 37px -> 515px (delta 478) for the same scenario on
main. The issue no longer reproduces.

CI: all required checks green on `140e23e7f` (Checks, Tests app-1/2/3,
integration, server, packages, Package Smoke ubuntu/macos, version
check).

Residual risks: error / missing-file / invalid-height branches still
render compact alerts, so loading -> error shrinks the card (error path,
out of scope). The loader no longer shows visible "Loading
visualization" text; it is conveyed through `role="status"` +
`aria-label`. No wire, CLI, or plugin-API surface changed, so no
protocol bump or doc update is required.

> AGENT GENERATED: by Claude Opus 5

Co-authored-by: Claude <[email protected]>
@ymichael

Copy link
Copy Markdown
Collaborator

Superseded by #2165

@ymichael ymichael closed this Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inline visualization loading causes a timeline layout jump

2 participants