Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(issues): keep the run spinner turning after a steer moves it (MUL-7729) (#8871)

Jiayuan Zhangbb40537c59fe
diff --git a/packages/views/issues/components/use-run-comment-motion.test.tsx b/packages/views/issues/components/use-run-comment-motion.test.tsx
index 74322eb7ea..fb3ca21617 100644
--- a/packages/views/issues/components/use-run-comment-motion.test.tsx
+++ b/packages/views/issues/components/use-run-comment-motion.test.tsx
@@ -128,6 +128,32 @@ describe("run comment motion", () => {
expect(disconnect).toHaveBeenCalledTimes(1);
});
+ it("keeps ambient run motion when one notification ends in view (MUL-7729)", async () => {
+ let notify!: IntersectionObserverCallback;
+ const observe = vi.fn();
+ vi.stubGlobal("IntersectionObserver", class {
+ constructor(callback: IntersectionObserverCallback) {
+ notify = callback;
+ }
+ observe = observe;
+ disconnect = vi.fn();
+ });
+ render(<Visibility />);
+ await waitFor(() => expect(observe).toHaveBeenCalledWith(screen.getByTestId("visibility")));
+ // A keyed move (a steer reply lands above the run) reports the detached
+ // row, then its new place, in a single callback.
+ act(() => notify([
+ { isIntersecting: false } as IntersectionObserverEntry,
+ { isIntersecting: true } as IntersectionObserverEntry,
+ ], {} as IntersectionObserver));
+ expect(screen.getByTestId("visibility")).toHaveAttribute("data-visible", "true");
+ act(() => notify([
+ { isIntersecting: true } as IntersectionObserverEntry,
+ { isIntersecting: false } as IntersectionObserverEntry,
+ ], {} as IntersectionObserver));
+ expect(screen.getByTestId("visibility")).toHaveAttribute("data-visible", "false");
+ });
+
it("rotates pointer disclosure with shared timing and keeps keyboard disclosure immediate", () => {
render(<Disclosure />);
const toggle = () => screen.getByRole("button", { name: "Toggle" });
diff --git a/packages/views/issues/components/use-run-comment-motion.ts b/packages/views/issues/components/use-run-comment-motion.ts
index 1d97ff1dee..8c43ab754a 100644
--- a/packages/views/issues/components/use-run-comment-motion.ts
+++ b/packages/views/issues/components/use-run-comment-motion.ts
@@ -45,7 +45,9 @@ export function useRunAnimationVisibility<T extends Element>() {
const ref = useCallback((node: T | null) => setElement(node), []);
useEffect(() => {
if (!element || typeof IntersectionObserver !== "function") return;
- const observer = new IntersectionObserver(([entry]) => setVisible(entry?.isIntersecting ?? true));
+ // One notification can queue several changes, oldest first: a keyed move
+ // reports the detached row, then its new place. Only the last is current.
+ const observer = new IntersectionObserver((entries) => setVisible(entries.at(-1)?.isIntersecting ?? true));
observer.observe(element);
return () => observer.disconnect();
}, [element]);