Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
fix(web): jump to the latest Message instantly and reuse RunningDots
jeffrey05a2f5b74573
diff --git a/apps/web/src/features/rooms/chat/jump-to-latest-button.tsx b/apps/web/src/features/rooms/chat/jump-to-latest-button.tsxindex 9ef432e4..807d690a 100644--- a/apps/web/src/features/rooms/chat/jump-to-latest-button.tsx+++ b/apps/web/src/features/rooms/chat/jump-to-latest-button.tsx@@ -2,6 +2,8 @@ import { ArrowDown02Icon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/ui/icon";+import { RunningDots } from "../task-sidebar/running-dots";+/*** Floats above the composer while the reader is away from the newest Message.* Typing dots replace the arrow while an Agent in the Room is still working, so@@ -23,11 +25,7 @@ export function JumpToLatestButton({type="button">{agentWorking ? (- <span aria-hidden="true" className="town-dots">- <span />- <span />- <span />- </span>+ <RunningDots size={5} />) : (<Icon icon={ArrowDown02Icon} size={16} />)}diff --git a/apps/web/src/features/rooms/chat/use-room-timeline-scroll.test.tsx b/apps/web/src/features/rooms/chat/use-room-timeline-scroll.test.tsxindex 9a472fb8..387a398f 100644--- a/apps/web/src/features/rooms/chat/use-room-timeline-scroll.test.tsx+++ b/apps/web/src/features/rooms/chat/use-room-timeline-scroll.test.tsx@@ -1,5 +1,5 @@import { fireEvent, render, screen } from "@testing-library/react";-import { afterEach, describe, expect, it, onTestFinished, vi } from "vitest";+import { afterEach, describe, expect, it, vi } from "vitest";import { useRoomTimelineScroll } from "./use-room-timeline-scroll";function Timeline({@@ -234,18 +234,6 @@ describe("Jump to latest", () => {() => height,);vi.spyOn(Element.prototype, "clientHeight", "get").mockReturnValue(200);- // jsdom does not implement element scrolling.- const scrollTo = vi.fn(function (this: Element, options: ScrollToOptions) {- this.scrollTop = options.top!;- fireEvent.scroll(this);- });- Object.defineProperty(Element.prototype, "scrollTo", {- configurable: true,- value: scrollTo,- });- onTestFinished(() => {- delete (Element.prototype as Partial<Element>).scrollTo;- });const view = render(<Timeline visible />);const timeline = screen.getByLabelText("Room timeline");expect(screen.queryByText("Jump to latest")).toBeNull();@@ -253,8 +241,9 @@ describe("Jump to latest", () => {timeline.scrollTop = 150;fireEvent.scroll(timeline);fireEvent.click(screen.getByText("Jump to latest"));+ fireEvent.scroll(timeline);- expect(scrollTo).toHaveBeenCalledWith({ top: 1000, behavior: "smooth" });+ expect(timeline.scrollTop).toBe(1000);expect(screen.queryByText("Jump to latest")).toBeNull();height = 1200;view.rerender(<Timeline visible messageCount={11} />);diff --git a/apps/web/src/features/rooms/chat/use-room-timeline-scroll.ts b/apps/web/src/features/rooms/chat/use-room-timeline-scroll.tsindex 58701062..1bbdb6bc 100644--- a/apps/web/src/features/rooms/chat/use-room-timeline-scroll.ts+++ b/apps/web/src/features/rooms/chat/use-room-timeline-scroll.ts@@ -256,8 +256,10 @@ export function useRoomTimelineScroll({if (!timeline) {return;}+ // An instant jump: a smooth scroll's intermediate scroll events would+ // switch following off and aim at a bottom that streaming has moved.shouldAutoFollowRef.current = true;- timeline.scrollTo({ top: timeline.scrollHeight, behavior: "smooth" });+ timeline.scrollTop = timeline.scrollHeight;}/** Whether the reader follows the newest Message rather than history. */