[codex] Upgrade Legend List chat scrolling #3545
Mergedjuliusmarmingemerged 5 commits into
main fromrefs/pull/3545/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -1492,4 +1432,20 @@1432+ {...(anchoredEndSpace ? { anchoredEndSpace } : {})}1433+ contentInsetEndAdjustment={props.contentInsetEndAdjustment}1434+ freeze={props.freeze}1435+ maintainScrollAtEnd={1436+ foldToggleSettling1437+ ? false1438+ : {1439+ animated: false,1440+ on: {1441+ dataChange: true,1442+ itemLayout: true,1443+ layout: true,1444+ },1445+ }1446+ }1447+ maintainVisibleContentPosition14921448 data={presentedFeed}14931449 extraData={listAppearanceData}14941450 renderItem={renderItem}1495- keyExtractor={(entry) => `${entry.type}:${entry.id}`}1451+ keyExtractor={(entry) => entry.id}apps/mobile/src/features/threads/ThreadDetailScreen.tsx lines 266 to 280OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -261,2 +262,19 @@261- );262- }, []);262+ useEffect(() => {263+ setAnchorMessageId(null);264+ }, [props.selectedThread.id]);265+266+ const handleSendMessage = useCallback(async () => {267+ const messageId = await props.onSendMessage();268+ if (messageId === null) {269+ return null;270+ }271+272+ setAnchorMessageId(messageId);273+ try {274+ await scrollMessageToEnd({ animated: true, closeKeyboard: true });275+ } catch {276+ freeze.set(false);277+ composerEditorRef.current?.blur();278+ }279+ return messageId;280+ }, [freeze, props.onSendMessage, scrollMessageToEnd]);
- apps/mobile/src/features/threads/ThreadFeed.tsx line 1428Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1492,4 +1432,20 @@1432+ {...(anchoredEndSpace ? { anchoredEndSpace } : {})}1433+ contentInsetEndAdjustment={props.contentInsetEndAdjustment}1434+ freeze={props.freeze}1435+ maintainScrollAtEnd={1436+ foldToggleSettling1437+ ? false1438+ : {1439+ animated: false,1440+ on: {1441+ dataChange: true,1442+ itemLayout: true,1443+ layout: true,1444+ },1445+ }1446+ }1447+ maintainVisibleContentPosition14921448 data={presentedFeed}14931449 extraData={listAppearanceData}14941450 renderItem={renderItem}1495- keyExtractor={(entry) => `${entry.type}:${entry.id}`}1451+ keyExtractor={(entry) => entry.id}apps/web/src/components/ChatView.tsx line 1176OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1143,3 +1156,21 @@11431156 const sendInFlightRef = useRef(false);11441157 const terminalUiOpenByThreadRef = useRef<Record<string, boolean>>({});114511581159+ useLayoutEffect(() => {1160+ const composerOverlay = composerOverlayRef.current;1161+ if (!composerOverlay) return;1162+1163+ const updateHeight = () => {1164+ const nextHeight = Math.ceil(composerOverlay.getBoundingClientRect().height);1165+ setComposerOverlayHeight((currentHeight) =>1166+ currentHeight === nextHeight ? currentHeight : nextHeight,1167+ );1168+ };1169+1170+ updateHeight();1171+ if (typeof ResizeObserver === "undefined") return;1172+1173+ const observer = new ResizeObserver(updateHeight);1174+ observer.observe(composerOverlay);1175+ return () => observer.disconnect();1176+ }, []);
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/mobile/src/features/threads/ThreadDetailScreen.tsx line 303Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -262,0 +276,21 @@276+ }, [freeze, selectedThreadKey]);277+278+ useEffect(() => {279+ if (280+ anchorMessageId === null ||281+ lastScrolledAnchorMessageIdRef.current === anchorMessageId ||282+ contentPresentationKind !== "ready" ||283+ !selectedThreadFeed.some((entry) => entry.type === "message" && entry.id === anchorMessageId)284+ ) {285+ return;286+ }287+288+ const targetThreadKey = selectedThreadKey;289+ const frame = requestAnimationFrame(() => {290+ if (selectedThreadKeyRef.current !== targetThreadKey) {291+ return;292+ }293+ lastScrolledAnchorMessageIdRef.current = anchorMessageId;294+ void scrollMessageToEnd({ animated: true, closeKeyboard: false }).catch(() => {295+ freeze.set(false);296+ });apps/mobile/src/state/use-thread-composer-state.ts line 128Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -125,4 +115,3 @@125115 };126116 }, [selectedThreadDetail, selectedThreadShell]);127117128- const queuedSendStartedAt = selectedThreadQueuedMessages[0]?.createdAt ?? null;
- @@ -4878,0 +4922,21 @@4922+ onStartFromOriginChange={onStartFromOriginChange}4923+ {...(canOverrideServerThreadEnvMode4924+ ? { effectiveEnvModeOverride: envMode }4925+ : {})}4926+ {...(canOverrideServerThreadEnvMode4927+ ? {4928+ activeThreadBranchOverride: activeThreadBranch,4929+ onActiveThreadBranchOverrideChange: setPendingServerThreadBranch,4930+ }4931+ : {})}4932+ envLocked={envLocked}4933+ onComposerFocusRequest={scheduleComposerFocus}4934+ {...(canCheckoutPullRequestIntoThread4935+ ? { onCheckoutPullRequestRequest: openPullRequestDialog }4936+ : {})}4937+ {...(hasMultipleEnvironments ? { onEnvironmentChange } : {})}4938+ availableEnvironments={logicalProjectEnvironments}4939+ />4940+ </div>4941+ )}4942+ </div>
juliusmarminge merged this22f021e
juliusmarminge closed this
Sign in to join this conversation.



Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
03b73ab7-c28b-496d-b15b-16b0130fedd9You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands.