diff --git a/ui/desktop/src/components/ChatInput.tsx b/ui/desktop/src/components/ChatInput.tsx
index 5f1ba35a..ecf8fe11 100644
--- a/ui/desktop/src/components/ChatInput.tsx
+++ b/ui/desktop/src/components/ChatInput.tsx
@@ -142,6 +142,7 @@ export default function ChatInput({
const [diagnosticsOpen, setDiagnosticsOpen] = useState(false);
const [showCreateRecipeModal, setShowCreateRecipeModal] = useState(false);
const [showEditRecipeModal, setShowEditRecipeModal] = useState(false);
+ const [isFilePickerOpen, setIsFilePickerOpen] = useState(false);
// Save queue state (paused/interrupted) to storage
useEffect(() => {
@@ -1014,12 +1015,18 @@ export default function ChatInput({
};
const handleFileSelect = async () => {
- const path = await window.electron.selectFileOrDirectory();
- if (path) {
- const newValue = displayValue.trim() ? `${displayValue.trim()} ${path}` : path;
- setDisplayValue(newValue);
- setValue(newValue);
- textAreaRef.current?.focus();
+ if (isFilePickerOpen) return;
+ setIsFilePickerOpen(true);
+ try {
+ const path = await window.electron.selectFileOrDirectory();
+ if (path) {
+ const newValue = displayValue.trim() ? `${displayValue.trim()} ${path}` : path;
+ setDisplayValue(newValue);
+ setValue(newValue);
+ textAreaRef.current?.focus();
+ }
+ } finally {
+ setIsFilePickerOpen(false);
}
};
@@ -1457,9 +1464,10 @@ export default function ChatInput({
diff --git a/ui/desktop/src/components/bottom_menu/DirSwitcher.tsx b/ui/desktop/src/components/bottom_menu/DirSwitcher.tsx
index d5d0c824..8aa80e25 100644
--- a/ui/desktop/src/components/bottom_menu/DirSwitcher.tsx
+++ b/ui/desktop/src/components/bottom_menu/DirSwitcher.tsx
@@ -8,12 +8,24 @@ interface DirSwitcherProps {
export const DirSwitcher: React.FC = ({ className = '' }) => {
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
+ const [isDirectoryChooserOpen, setIsDirectoryChooserOpen] = useState(false);
const handleDirectoryChange = async () => {
- window.electron.directoryChooser(true);
+ if (isDirectoryChooserOpen) return;
+ setIsDirectoryChooserOpen(true);
+ try {
+ await window.electron.directoryChooser(true);
+ } finally {
+ setIsDirectoryChooserOpen(false);
+ }
};
const handleDirectoryClick = async (event: React.MouseEvent) => {
+ if (isDirectoryChooserOpen) {
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
const isCmdOrCtrlClick = event.metaKey || event.ctrlKey;
if (isCmdOrCtrlClick) {
@@ -28,11 +40,17 @@ export const DirSwitcher: React.FC = ({ className = '' }) => {
return (
-
+ {
+ if (!isDirectoryChooserOpen) setIsTooltipOpen(open);
+ }}
+ >