Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chg(new-channels): remove sticky logic from the thread list (#1903)

teo0f6e02238c08
diff --git a/js/app/packages/channel/Channel/ThreadList.tsx b/js/app/packages/channel/Channel/ThreadList.tsx
index 268dcf72c8..e8a5088828 100644
--- a/js/app/packages/channel/Channel/ThreadList.tsx
+++ b/js/app/packages/channel/Channel/ThreadList.tsx
@@ -1,10 +1,4 @@
-import {
- type Accessor,
- type JSX,
- createSignal,
- createEffect,
- on,
-} from 'solid-js';
+import { type Accessor, type JSX, createSignal } from 'solid-js';
import { type VirtualizerHandle, Virtualizer } from 'virtua/solid';
import type { ScrollToIndexOpts } from 'virtua/unstable_core';
@@ -80,14 +74,6 @@ export const DEFAULT_INITIAL_SCROLL_TARGET: ThreadListScrollTarget = {
const clamp = (value: number, min: number, max: number) =>
Math.max(min, Math.min(value, max));
-export function shouldStickToBottomOnDataChange(
- isNearBottom: boolean,
- shift?: Accessor<boolean>,
- prepend?: Accessor<boolean>
-): boolean {
- return isNearBottom && !(shift?.() ?? false) && !(prepend?.() ?? false);
-}
-
export function isExplicitScrollDown(
delta: number,
intent: ExplicitScrollIntent | undefined,
@@ -254,27 +240,6 @@ export function ThreadList(props: ThreadListProps) {
});
}
- createEffect(
- on(
- () => props.keys().length,
- () => {
- const handle = virtualHandle();
- if (!handle || !didInitialScroll()) return;
- if (
- shouldStickToBottomOnDataChange(
- isNearBottom(),
- props.shift,
- props.prepend
- )
- ) {
- requestAnimationFrame(() => {
- scrollToTarget(handle, { tag: 'bottom', align: 'end' });
- });
- }
- }
- )
- );
-
const handleScroll = () => {
const handle = virtualHandle();
if (!handle) return;
diff --git a/js/app/packages/channel/Channel/tests/thread-list-scroll.test.ts b/js/app/packages/channel/Channel/tests/thread-list-scroll.test.ts
index 84d1fc53bb..6fd3cbfc1f 100644
--- a/js/app/packages/channel/Channel/tests/thread-list-scroll.test.ts
+++ b/js/app/packages/channel/Channel/tests/thread-list-scroll.test.ts
@@ -3,36 +3,8 @@ import {
accumulateExplicitScrollDownDistance,
hasExplicitScrollDownGesture,
isExplicitScrollDown,
- shouldStickToBottomOnDataChange,
} from '../ThreadList';
-describe('shouldStickToBottomOnDataChange', () => {
- it('sticks when near bottom and not shifting', () => {
- expect(shouldStickToBottomOnDataChange(true)).toBe(true);
- expect(shouldStickToBottomOnDataChange(true, () => false)).toBe(true);
- });
-
- it('does not stick when not near bottom', () => {
- expect(shouldStickToBottomOnDataChange(false)).toBe(false);
- expect(shouldStickToBottomOnDataChange(false, () => false)).toBe(false);
- expect(shouldStickToBottomOnDataChange(false, () => true)).toBe(false);
- });
-
- it('does not stick while shifting', () => {
- expect(shouldStickToBottomOnDataChange(true, () => true)).toBe(false);
- });
-
- it('does not stick while prepending', () => {
- expect(
- shouldStickToBottomOnDataChange(
- true,
- () => false,
- () => true
- )
- ).toBe(false);
- });
-});
-
describe('isExplicitScrollDown', () => {
it('returns true only for recent explicit down intent', () => {
expect(