@devries-cameron20 / t3code Mirror · read-only / commits / a72b58e127
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 05:30 UTC

fix(web): settings search keeps the clamped highlight when results shrink (#20764)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 16, 2026 at 22:39 UTC a72b58e127a5a1e8c40c09f6334d6e72a50cbe6b
1 file changed +6 -2
apps/web/src/components/settings/SettingsSidebarNav.tsx
+6 -2
@@ -118,12 +118,16 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
118 const { isMobile, setOpenMobile, open, setOpen } = useSidebar();
119 const searchInputRef = useRef<HTMLInputElement>(null);
120 const [query, setQuery] = useState("");
121 - const [storedActiveResultIndex, setActiveResultIndex] = useState(0);
121 + const [activeResultIndex, setActiveResultIndex] = useState(0);
122 const searchableItems = useAvailableSettingsSearchItems(scopeSearch);
123 const results = searchSettings(query, searchableItems);
124 const isSearching = query.trim().length > 0;
125 const hasResults = results.length > 0;
126 - const activeResultIndex = Math.min(storedActiveResultIndex, Math.max(results.length - 1, 0));
126 + const maxResultIndex = Math.max(results.length - 1, 0);
127 + // Persist the clamp so a shrink-then-recover of results keeps the clamped highlight.
128 + if (activeResultIndex > maxResultIndex) {
129 + setActiveResultIndex(maxResultIndex);
130 + }
131
132 useEffect(() => {
133 const result = results[activeResultIndex];