Repository navigation
Conversation
… centre the rail independent of the card
…d cap it inside its slot
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
On a slow connection the pinned thread context card held back the transcript's layout until a card row rendered DOM (#8531). The transcript reserves the card's 1384 px centring width only while
isCardShownis true, and for a pinned card that waited oncardHasContent, aMutationObserveron the card body.usePaneStatealso stayednulluntil rows were revealed. So the first paint centred the column across the whole pane, and when the slowest row's data arrived (about 25 s at Slow 4G) the 760 px column and composer moved 132 px left. The thread outline satmy-autounder the card, so it also moved whenever the card's height changed.What changed
PluginThreadContextCard.tsx: the card is shown from the synced pin, or from a per-thread choice for a card that has no content yet. Row content is no longer an input, socardHasContentand itsMutationObserverare removed. The transcript's centring width now depends only on that state. Clicking the header on a card with content flips the synced pin. Clicking it on an empty card toggles that thread only. The card ishiddenrather than unmounted, and its height is capped inside its slot.thread-context-card-pane.ts: the pane layout depends on registered rows and sections (hasItems), not revealed ones, so lazy parts no longer flip it frombannertocard.synced-preference-atom.tsandui-preferences-sync.ts: synced preferences can keep a per-device last-known value (bb.threadContextCard.pinnedin localStorage). The atom initialises from it lazily, and reconciling with the server also saves the value when it didn't change. With no saved value the card lays out for the shipped default (true). A pin the user sets before the server answers counts immediately.ThreadScreen.tsx: the scroll overlay is a flex column with the card in aflex-1 basis-0slot and a matching spacer under the outline, so the outline is centred whatever the card's height.docs/configuration.md: the "Thread context card" section describes the pin, the per-thread toggle on an empty card, and the default layout.No wire, CLI or protocol changes.
Accepted edge: on a device's very first load (no saved value), a server value of
falsethat arrives late moves the column back once (x 368 → 500). After that the value is saved, and later loads don't shift.Tradeoff: the card's height is now capped at its slot, about half the pane, so the outline stays centred.
How you verified
CLS (largest session window) from the layout-shift audit harness: source build, Chrome headless over CDP, Slow 4G, cache disabled, 4× CPU, 1440×900, two cold loads each. Base is
mainate0c49e2e5d./preferences/uiresponse:truewith nothing saved keeps x = 368. Before: 500 → 368.falseafter a reload keeps x = 500.Tests:
PluginThreadContextCard.test.tsx:trueorfalse;ui-preferences-sync.test.ts: reconciling an unchanged value saves it as last known.ThreadScreen.test.tsx: the outline sits between equal flex spacers, independent of the card.Checks:
pnpm exec turbo run typecheck test lint lint:type-aware --filter=@bb/app(10/10 tasks; 7584 passed, 19 skipped)@bb/appbuildoxfmt --checkgit diff --checkCloses #8531