Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: the consistency of the go-to-anything interaction (#28857)

非法操作c51ab6ec3722
diff --git a/web/app/components/goto-anything/index.tsx b/web/app/components/goto-anything/index.tsx
index 1f153190f2c..5cdf9707253 100644
--- a/web/app/components/goto-anything/index.tsx
+++ b/web/app/components/goto-anything/index.tsx
@@ -187,6 +187,19 @@ const GotoAnything: FC<Props> = ({
}, {} as { [key: string]: SearchResult[] }),
[searchResults])
+ useEffect(() => {
+ if (isCommandsMode)
+ return
+
+ if (!searchResults.length)
+ return
+
+ const currentValueExists = searchResults.some(result => `${result.type}-${result.id}` === cmdVal)
+
+ if (!currentValueExists)
+ setCmdVal(`${searchResults[0].type}-${searchResults[0].id}`)
+ }, [isCommandsMode, searchResults, cmdVal])
+
const emptyResult = useMemo(() => {
if (searchResults.length || !searchQuery.trim() || isLoading || isCommandsMode)
return null
@@ -386,7 +399,7 @@ const GotoAnything: FC<Props> = ({
<Command.Item
key={`${result.type}-${result.id}`}
value={`${result.type}-${result.id}`}
- className='flex cursor-pointer items-center gap-3 rounded-md p-3 will-change-[background-color] aria-[selected=true]:bg-state-base-hover data-[selected=true]:bg-state-base-hover'
+ className='flex cursor-pointer items-center gap-3 rounded-md p-3 will-change-[background-color] hover:bg-state-base-hover aria-[selected=true]:bg-state-base-hover-alt data-[selected=true]:bg-state-base-hover-alt'
onSelect={() => handleNavigate(result)}
>
{result.icon}