diff --git a/apps/desktop/src/components/redis/RedisKeyBrowser.vue b/apps/desktop/src/components/redis/RedisKeyBrowser.vue index 73cec3eeee..1b264c67f4 100644 --- a/apps/desktop/src/components/redis/RedisKeyBrowser.vue +++ b/apps/desktop/src/components/redis/RedisKeyBrowser.vue @@ -813,6 +813,7 @@ function typeColor(type: string): string { } let searchTimer: ReturnType | null = null; +let hasAutoFocusedSearch = false; function onSearchInput() { if (searchTimer) clearTimeout(searchTimer); @@ -834,6 +835,15 @@ function getSearchInput(): HTMLInputElement | null { return rootRef.value?.querySelector("[data-redis-search-input]") ?? null; } +async function autofocusSearchOnce() { + if (hasAutoFocusedSearch) return; + await nextTick(); + const input = getSearchInput(); + if (!input) return; + hasAutoFocusedSearch = true; + input.focus({ preventScroll: true }); +} + function getCommandInput(): HTMLInputElement | null { return rootRef.value?.querySelector("[data-redis-command-input]") ?? null; } @@ -938,6 +948,7 @@ function onCommandInputKeydown(event: KeyboardEvent) { onMounted(async () => { resumeRedisBrowserBackgroundWork(); + void autofocusSearchOnce(); try { await connectionStore.ensureConnected(props.connectionId); } catch (e) { @@ -948,6 +959,7 @@ onMounted(async () => { onActivated(async () => { resumeRedisBrowserBackgroundWork(); + void autofocusSearchOnce(); // Ensure the connection is still alive after reactivation (e.g. tab switch). // If keys failed to load previously (empty list), retry loading. try { @@ -981,33 +993,57 @@ defineExpose({ focusSearch });
-
- -
- - - +
+
+
+ + + +
+
+ {{ keyCountText }} + + + +
+
+
+
+ + +
+
- - - - - {{ keyCountText }} -