diff --git a/src/renderer/src/components/right-sidebar/AiVaultSessionLimitMenu.tsx b/src/renderer/src/components/right-sidebar/AiVaultSessionLimitMenu.tsx index 45db6caa9c7..39b929732b2 100644 --- a/src/renderer/src/components/right-sidebar/AiVaultSessionLimitMenu.tsx +++ b/src/renderer/src/components/right-sidebar/AiVaultSessionLimitMenu.tsx @@ -7,56 +7,13 @@ import { DropdownMenuSubContent, DropdownMenuSubTrigger } from '@/components/ui/dropdown-menu' -import { Button } from '@/components/ui/button' import { translate } from '@/i18n/i18n' import { - AI_VAULT_SESSION_LIMIT_STEP, AI_VAULT_SESSION_LIMITS, DEFAULT_AI_VAULT_SESSION_LIMIT, - nextAiVaultSessionLimit, type AiVaultSessionLimit } from './ai-vault-session-limit' -/** Footer row once the scan filled its History depth; steps the same setting the menu edits. */ -export function AiVaultShowMoreSessionsRow({ - loaded, - loading, - sessionLimit, - onSessionLimitChange -}: { - loaded: number - loading: boolean - sessionLimit: AiVaultSessionLimit - onSessionLimitChange: (limit: AiVaultSessionLimit) => void -}): React.JSX.Element | null { - const next = nextAiVaultSessionLimit(sessionLimit) - if (next === null || sessionLimit === 'unlimited' || loaded === 0) { - return null - } - // Why: a step raises the depth before the rescan lands, so the row must survive - // that gap in a loading state instead of vanishing until the new rows paint. - const filled = loaded >= sessionLimit - const stepping = loading && loaded >= sessionLimit - AI_VAULT_SESSION_LIMIT_STEP - if (!filled && !stepping) { - return null - } - return ( -
- -
- ) -} - export function AiVaultSessionLimitMenu({ sessionLimit, onSessionLimitChange diff --git a/src/renderer/src/components/right-sidebar/AiVaultSessionLimitMenu.test.tsx b/src/renderer/src/components/right-sidebar/AiVaultShowMoreSessionsRow.test.tsx similarity index 59% rename from src/renderer/src/components/right-sidebar/AiVaultSessionLimitMenu.test.tsx rename to src/renderer/src/components/right-sidebar/AiVaultShowMoreSessionsRow.test.tsx index 11cbfd8d05c..105c021d5d2 100644 --- a/src/renderer/src/components/right-sidebar/AiVaultSessionLimitMenu.test.tsx +++ b/src/renderer/src/components/right-sidebar/AiVaultShowMoreSessionsRow.test.tsx @@ -2,7 +2,7 @@ import { cleanup, render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import { afterEach, expect, it, vi } from 'vitest' -import { AiVaultShowMoreSessionsRow } from './AiVaultSessionLimitMenu' +import { AiVaultShowMoreSessionsRow } from './AiVaultShowMoreSessionsRow' afterEach(cleanup) @@ -11,6 +11,7 @@ it('steps the history depth up by one page once the scan filled it', async () => render( { render( { expect(button.hasAttribute('disabled')).toBe(true) }) +// Why: the old rule inferred "stepping" from the selected depth minus a page, which at the +// default depth is zero, so every foreground rescan claimed more history was coming. +it('stays hidden during a foreground rescan the scan had room for', () => { + render( + + ) + expect(screen.queryByRole('button')).toBeNull() +}) + it('stays hidden while the scan has room or is already unlimited', () => { render(