Skip to content
Source
Sign inSign up
pingdotgg/t3code

Tighten chat auto-tail to true bottom position #81

Closedjuliusmarmingewants to merge 4 commits intomain fromcodething/b1c10980opened View on GitHub

Showing 3 changed files with 118 additions and 28 deletions (loading 1).

x
0 of 3 viewed, 3 left
92 additions and 12 deletionsapps/web/src/components/ChatView.tsxModified
View file
@@ -17,6 +17,9 @@
type DragEvent,
type FormEvent,
type KeyboardEvent,
+ type PointerEvent,
+ type TouchEvent,
+ type WheelEvent,
memo,
type RefObject,
useCallback,
@@ -61,7 +64,7 @@
formatElapsed,
formatTimestamp,
} from "../session-logic";
-import { isScrollContainerNearBottom } from "../chat-scroll";
+import { isScrollContainerAtBottom } from "../chat-scroll";
import { useStore } from "../store";
import { truncateTitle } from "../truncateTitle";
import {
@@ -402,6 +405,11 @@
>(() => readLastInvokedScriptByProjectFromStorage());
const messagesScrollRef = useRef<HTMLDivElement>(null);
const shouldAutoScrollRef = useRef(true);
+ const lastKnownScrollTopRef = useRef(0);
+ const isPointerScrollActiveRef = useRef(false);
+ const lastTouchClientYRef = useRef<number | null>(null);
+ const pendingUserScrollUpIntentRef = useRef(false);
+ const pendingAutoScrollFrameRef = useRef<number | null>(null);