Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🔧 refactor: Update Avatar component to improve file selection handling (#10555)

Joseph Licata3dd827e9d299
diff --git a/client/src/components/Nav/SettingsTabs/Account/Avatar.tsx b/client/src/components/Nav/SettingsTabs/Account/Avatar.tsx
index ed677f771a..e8b4437368 100644
--- a/client/src/components/Nav/SettingsTabs/Account/Avatar.tsx
+++ b/client/src/components/Nav/SettingsTabs/Account/Avatar.tsx
@@ -134,8 +134,13 @@ function Avatar() {
e.preventDefault();
}, []);
- const openFileDialog = () => {
+ const openFileDialog = useCallback(() => {
fileInputRef.current?.click();
+ }, []);
+
+ const handleSelectFileClick = (event: React.MouseEvent) => {
+ event.stopPropagation();
+ openFileDialog();
};
const resetImage = useCallback(() => {
@@ -341,7 +346,7 @@ function Avatar() {
: '2MB',
})}
</p>
- <Button type="button" variant="secondary" onClick={openFileDialog}>
+ <Button type="button" variant="secondary" onClick={handleSelectFileClick}>
{localize('com_ui_select_file')}
</Button>
<input