fix(web): show the scroll-to-end pill when the chat is not at the newest message #12376
Closedbompus(GitHub profile, opens in a new tab)wants to merge 4 commits into
main fromrefs/pull/12376/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/components/chat/MessagesTimeline.logic.ts line 217Resolvedby bompus(GitHub profile, opens in a new tab)@@ -174,0 +198,21 @@198+ * away from the live edge.199+ *200+ * A viewport that drifted off the end while follow was still engaged and the201+ * user never opted out is treated as a real leave-end: the caller clears the202+ * follow generation and reports away-from-end so the scroll-to-end pill can203+ * appear. Anything the user (or another positioning owner) controls only gets204+ * its end state reported — never a yank, never a programmatic scroll. This205+ * helper owns pill state only; viewport position belongs to the follow/anchor206+ * paths (#5903, #5905, #10773). Unknown or mid-transition states are ignored;207+ * the scroll-driven path owns them.208+ */209+export function resolveTimelineEndSettleAction(210+ input: TimelineEndSettleInput,211+): TimelineEndSettleAction {212+ if (input.isAtEnd !== false) {213+ return "ignore";214+ }215+ if (input.restoring || input.citationActive || !input.listDataCurrent) {216+ return "ignore";217+ }218+ if (input.anchorActive || input.disclosureSettling) {
- apps/web/src/components/chat/MessagesTimeline.tsx lines 1072 to 1080Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -1007,0 +1040,21 @@1040+ const state = list?.getState?.();1041+ if (!list || !state) return;1042+ const action = resolveTimelineEndSettleAction({1043+ liveFollowEnabled,1044+ isWorking,1045+ anchorActive: anchoredEndSpace !== undefined,1046+ disclosureSettling: disclosureToggleSettling,1047+ citationActive: citationPositioning,1048+ restoring: restoringThreadPosition,1049+ listDataCurrent: state.data === rows,1050+ isAtEnd: resolveTimelineIsAtEnd(state),1051+ });1052+ if (action !== "leave-end") {1053+ unconfirmedLeaveRef.current = false;1054+ // Someone owns this position (or may own it): never yank, only make1055+ // sure the pill can appear. Deliberately not forwarding `true` — auto1056+ // re-follow stays with real scroll events.1057+ if (action === "report-away-from-end") {1058+ onIsAtEndChange(false);1059+ }1060+ return;
bompus(GitHub profile, opens in a new tab) changed the title
bompus(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed