Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): slash command popup hidden by transform containing block (#283)

Gener3c9d502da713
diff --git a/src/web/src/app/globals.css b/src/web/src/app/globals.css
index 3b6af0cc6..c457e3bfb 100644
--- a/src/web/src/app/globals.css
+++ b/src/web/src/app/globals.css
@@ -1723,7 +1723,6 @@ html, body {
[data-keyboard-offset] {
transition: transform 0.2s ease-out;
- will-change: transform;
}
[data-keyboard-offset][data-keyboard-active]::before {
diff --git a/src/web/src/components/agent-chat/agent-chat-view.tsx b/src/web/src/components/agent-chat/agent-chat-view.tsx
index 632af7474..73d8a3031 100644
--- a/src/web/src/components/agent-chat/agent-chat-view.tsx
+++ b/src/web/src/components/agent-chat/agent-chat-view.tsx
@@ -763,17 +763,16 @@ export function AgentChatView({
[agents, agentId],
);
- // Slash command skills — fetch from D1 on mount
+ // Slash command skills — fetch from D1 on mount (and when agentId changes)
const [agentSkills, setAgentSkills] = useState<SkillEntry[]>([]);
- const skillsFetchedRef = useRef(false);
const draftMetaRestoredRef = useRef(false);
useEffect(() => {
- if (skillsFetchedRef.current) return;
- skillsFetchedRef.current = true;
+ let stale = false;
getAgentSkills(agentId, workspaceId)
- .then((res) => setAgentSkills(res.skills as SkillEntry[]))
+ .then((res) => { if (!stale) setAgentSkills(res.skills as SkillEntry[]); })
.catch(() => {});
+ return () => { stale = true; };
}, [agentId, workspaceId]);
const [initialActiveSkill] = useState<SkillEntry | null>(() => {
diff --git a/src/web/src/components/agent-chat/slash-command-popup.tsx b/src/web/src/components/agent-chat/slash-command-popup.tsx
index 8a7d833de..135605b44 100644
--- a/src/web/src/components/agent-chat/slash-command-popup.tsx
+++ b/src/web/src/components/agent-chat/slash-command-popup.tsx
@@ -1,4 +1,5 @@
import React, { useRef, useEffect } from "react"
+import { createPortal } from "react-dom"
import type { SkillEntry } from "@alook/shared"
import { cn } from "@/lib/utils"
@@ -69,7 +70,7 @@ export function SlashCommandPopup({ isOpen, skills, selectedIndex, onSelect, anc
: anchorPos.left
const clampedLeft = Math.min(anchorPos.left, maxLeft)
- return (
+ return createPortal(
<div
className="fixed z-100 w-70 rounded-lg border border-border bg-popover text-popover-foreground shadow-md transition-opacity duration-150"
style={{
@@ -88,6 +89,7 @@ export function SlashCommandPopup({ isOpen, skills, selectedIndex, onSelect, anc
/>
))}
</div>
- </div>
+ </div>,
+ document.body,
)
}