fix(quick-pane): keep pane open on blur
This commit is contained in:
@@ -76,9 +76,7 @@ export default function QuickPane() {
|
||||
const [escalation, setEscalation] = useState<string>();
|
||||
const [extension, setExtension] = useState<Extension>();
|
||||
const runtimeRef = useRef<Runtime | undefined>(undefined);
|
||||
const requestRef = useRef(request);
|
||||
const inputRef = useRef<HTMLTextAreaElement>(null);
|
||||
const phaseRef = useRef<"idle" | "starting" | "running">("idle");
|
||||
const invalid = useMemo(() => settingsError(settings), [settings]);
|
||||
|
||||
const dismissPane = () => getCurrentWindow().hide();
|
||||
@@ -139,11 +137,7 @@ export default function QuickPane() {
|
||||
};
|
||||
window.addEventListener("keydown", onKeyDown);
|
||||
const focusListener = paneWindow.onFocusChanged((event) => {
|
||||
if (event.payload) {
|
||||
focusInput();
|
||||
} else if (phaseRef.current === "idle" && !requestRef.current.trim()) {
|
||||
void dismissPane();
|
||||
}
|
||||
if (event.payload) focusInput();
|
||||
});
|
||||
const closeListener = paneWindow.onCloseRequested((event) => {
|
||||
event.preventDefault();
|
||||
@@ -227,7 +221,6 @@ export default function QuickPane() {
|
||||
setAnswer("");
|
||||
setEscalation(undefined);
|
||||
setExtension(undefined);
|
||||
phaseRef.current = "starting";
|
||||
setStatus("Starting advisory quick agent…");
|
||||
try {
|
||||
const result = await invoke<{ runtime: Runtime }>(
|
||||
@@ -253,12 +246,10 @@ export default function QuickPane() {
|
||||
agentId: result.runtime.agentId,
|
||||
message: guardrails,
|
||||
});
|
||||
phaseRef.current = "running";
|
||||
setStatus(
|
||||
"Quick request running. Advisory limits are not trusted enforcement.",
|
||||
);
|
||||
} catch (reason) {
|
||||
phaseRef.current = "idle";
|
||||
setError(`Could not start quick request: ${String(reason)}`);
|
||||
setStatus("");
|
||||
}
|
||||
@@ -314,7 +305,6 @@ export default function QuickPane() {
|
||||
ref={inputRef}
|
||||
value={request}
|
||||
onChange={(e) => {
|
||||
requestRef.current = e.target.value;
|
||||
setRequest(e.target.value);
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
|
||||
Reference in New Issue
Block a user