@@ -106,9 +106,7 @@ import { uuidv4 } from "../../lib/uuid";
106106import {
107107 resolveMarkdownFontSizes ,
108108 resolveNativeMarkdownTypography ,
109- scaledTypographyLineHeight ,
110109} from "../../lib/appearancePreferences" ;
111- import { MOBILE_TYPOGRAPHY } from "../../lib/typography" ;
112110import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider" ;
113111import { useAppearanceCodeSurface } from "../settings/appearance/useAppearanceCodeSurface" ;
114112import { markdownFileIconSource } from "@t3tools/mobile-markdown-text/file-icons" ;
@@ -128,13 +126,8 @@ import {
128126 resolveThreadFeedLiveFollow ,
129127 type ThreadFeedLiveFollowEvent ,
130128} from "./thread-feed-live-follow" ;
131- import {
132- collapsedWorkLogHeight ,
133- ThreadDisclosureChevron ,
134- ThreadWorkGroupToggle ,
135- ThreadWorkLog ,
136- WORK_GROUP_TOGGLE_HEIGHT ,
137- } from "./thread-work-log" ;
129+ import { ThreadWorkGroupToggle , ThreadWorkLog } from "./thread-work-log" ;
130+ import { resolveThreadFeedFixedItemSize } from "./thread-feed-item-size" ;
138131import { useMarkdownCodeHighlight } from "./markdownCodeHighlightState" ;
139132import { useAssetUrl } from "../../state/assets" ;
140133import { appAtomRegistry } from "../../state/atom-registry" ;
@@ -165,16 +158,6 @@ function formatMessageTime(input: string): string {
165158 return MESSAGE_TIME_FORMATTER . format ( timestamp ) ;
166159}
167160
168- // Pre-measurement heights for getFixedItemSize, mirroring renderFeedEntry's
169- // classNames. The fold row's min-h-11 (44px) stays taller than its single
170- // text-sm line at every supported base font size (26px at the 22pt maximum),
171- // so its height is a constant; a drifted value costs one correction on
172- // measure, not a persistent offset.
173- const TURN_FOLD_HEIGHT = 56 ; // min-h-11 (44) + mb-3 (12)
174- // The working row has no min-height clamp — its height follows the scaled
175- // text-xs line height (see workingRowHeight in ThreadFeed).
176- const WORKING_ROW_VERTICAL_EXTRAS = 24 ; // py-1 (8) + mb-4 (16)
177-
178161// Entering animations must only play for rows born just now — LegendList
179162// remounts rows when they scroll back into view, and replaying an entrance for
180163// old content would be its own kind of jank.
@@ -2244,34 +2227,13 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
22442227 // scrolling up through unmeasured content corrects each row's height as it
22452228 // mounts — the feed visibly jumps. Fixed sizes make the small chrome rows
22462229 // exact; message rows stay undefined and use LegendList's per-type running
2247- // average once one of their type has been measured. Text-driven heights
2248- // follow the configurable base font size via scaledTypographyLineHeight.
2249- const workingRowHeight =
2250- WORKING_ROW_VERTICAL_EXTRAS +
2251- scaledTypographyLineHeight ( MOBILE_TYPOGRAPHY . label , appearance . baseFontSize ) ;
2230+ // average once one of their type has been measured. Activity groups are
2231+ // also content-driven: prominent v2 items add a card and related-thread
2232+ // link, so marking them fixed would make LegendList skip their measurement
2233+ // and position the next message inside the card.
22522234 const getFixedItemSize = useCallback (
2253- ( entry : ThreadFeedEntry ) => {
2254- if ( workRowSizing . fixedRowHeight === undefined ) {
2255- return undefined ;
2256- }
2257- switch ( entry . type ) {
2258- case "run-fold" :
2259- return TURN_FOLD_HEIGHT ;
2260- case "work-toggle" :
2261- return WORK_GROUP_TOGGLE_HEIGHT ;
2262- case "working" :
2263- return workingRowHeight ;
2264- case "activity-group" :
2265- // Expanded rows append a variable detail block — fall back to
2266- // measurement for those groups.
2267- return entry . activities . some ( ( activity ) => expandedWorkRows [ activity . id ] )
2268- ? undefined
2269- : collapsedWorkLogHeight ( entry . activities , appearance . baseFontSize ) ;
2270- default :
2271- return undefined ;
2272- }
2273- } ,
2274- [ expandedWorkRows , workingRowHeight , appearance . baseFontSize ] ,
2235+ ( entry : ThreadFeedEntry ) => resolveThreadFeedFixedItemSize ( entry . type , appearance . baseFontSize ) ,
2236+ [ appearance . baseFontSize ] ,
22752237 ) ;
22762238
22772239 // Disclosures can mount existing offscreen rows as well as new work rows.
0 commit comments