diff --git a/src/renderer/src/components/native-chat/native-chat-message-rail-items.ts b/src/renderer/src/components/native-chat/native-chat-message-rail-items.ts index 1ad2ba71a39..755d3412316 100644 --- a/src/renderer/src/components/native-chat/native-chat-message-rail-items.ts +++ b/src/renderer/src/components/native-chat/native-chat-message-rail-items.ts @@ -13,9 +13,6 @@ import type { NativeChatTranscriptSlot } from './native-chat-transcript-slots' * read at a glance, which is the only thing the rail is for. */ export const NATIVE_CHAT_RAIL_MAX_TICKS = 20 -/** Below this a rail is noise — two ticks say nothing a scrollbar doesn't. */ -export const NATIVE_CHAT_RAIL_MIN_ITEMS = 3 - export type NativeChatRailItem = { id: string /** Index into the slot list, i.e. the virtualizer's own index. Null while the diff --git a/src/renderer/src/components/native-chat/use-native-chat-message-rail.test.ts b/src/renderer/src/components/native-chat/use-native-chat-message-rail.test.ts index 518e33a9586..796b11f6f2f 100644 --- a/src/renderer/src/components/native-chat/use-native-chat-message-rail.test.ts +++ b/src/renderer/src/components/native-chat/use-native-chat-message-rail.test.ts @@ -114,7 +114,7 @@ describe('message rail hook', () => { expect(scrollSubscriptions).toHaveLength(1) }) - it('ticks every user message and hides below the minimum', () => { + it('ticks every user message and shows from the first one', () => { const element = document.createElement('div') const scrollRef = { current: element } @@ -124,14 +124,19 @@ describe('message rail hook', () => { expect(result.current.items.map((item) => item.id)).toEqual(['u1', 'u2', 'u3']) expect(result.current.visible).toBe(true) - const { result: short } = renderHook(() => + const { result: single } = renderHook(() => useNativeChatMessageRail({ scrollRef, slots: slotsOf([message('u1', 'user'), message('a1', 'assistant')]), virtualItems: [] }) ) - expect(short.current.visible).toBe(false) + expect(single.current.visible).toBe(true) + + const { result: empty } = renderHook(() => + useNativeChatMessageRail({ scrollRef, slots: [], virtualItems: [] }) + ) + expect(empty.current.visible).toBe(false) }) it('maps user messages above the loaded window from the outline, before the loaded ones', () => { @@ -145,7 +150,6 @@ describe('message rail hook', () => { const { result } = renderHook(() => useNativeChatMessageRail({ scrollRef, slots: slotsOf(loaded), virtualItems: [], outline }) ) - // One loaded prompt alone would hide the rail; the outline is what makes it a map. expect(result.current.visible).toBe(true) expect(result.current.items.map((item) => item.id)).toEqual([ ...outline.map((entry) => entry.id), diff --git a/src/renderer/src/components/native-chat/use-native-chat-message-rail.ts b/src/renderer/src/components/native-chat/use-native-chat-message-rail.ts index cda840fa33d..b066401b23b 100644 --- a/src/renderer/src/components/native-chat/use-native-chat-message-rail.ts +++ b/src/renderer/src/components/native-chat/use-native-chat-message-rail.ts @@ -11,7 +11,6 @@ import { buildNativeChatRailItems, mergeNativeChatRailOutline, selectNativeChatRailTicks, - NATIVE_CHAT_RAIL_MIN_ITEMS, type NativeChatRailItem, type NativeChatRailOutlineEntry } from './native-chat-message-rail-items' @@ -135,7 +134,7 @@ export function useNativeChatMessageRail({ ticks, items, activeId, - visible: wideEnough && items.length >= NATIVE_CHAT_RAIL_MIN_ITEMS + visible: wideEnough && items.length > 0 }), [ticks, items, activeId, wideEnough] )