From 3209e088e5eebd26f4ed845cf89c1dd340d84b0e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 13:45:58 +0800 Subject: [PATCH] Fix toast visibility and Create Look dialog error handling (#49) * Fix toast visibility z-index issue and Create Look dialog error handling - Moved `` outside of `SidebarProvider` in `Layout.tsx` and increased z-index to ensure toasts appear above dialog overlays. - Updated `CreateLookDialog.tsx` to use `toast.error()` for API errors instead of displaying them inline at the bottom of the dialog. * Fix Extractor error handling, toast visibility, and Create Look dialog errors - Updated `ExtractorDialog.tsx` to reset the stage to `'selection'` on refinement error, preventing infinite loading. - Updated `CreateLookDialog.tsx` to use `toast.error()` for API errors instead of inline text. - Moved `` in `Layout.tsx` outside of `SidebarProvider` to ensure toasts appear above dialog overlays. - Ensured `package.json` and `sonner.tsx` remain clean (reverted temporary changes). * fix sonner * fix lint --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: yiling ji --- src/ui/Layout.tsx | 50 ++++++++++++++------------ src/ui/components/CreateLookDialog.tsx | 17 ++++----- src/ui/components/ExtractorDialog.tsx | 1 + src/ui/components/ui/sonner.tsx | 29 +++++++-------- 4 files changed, 50 insertions(+), 47 deletions(-) diff --git a/src/ui/Layout.tsx b/src/ui/Layout.tsx index fa3168a..933b4fb 100644 --- a/src/ui/Layout.tsx +++ b/src/ui/Layout.tsx @@ -3,31 +3,35 @@ import { AppSidebar } from './components/AppSidebar' import { Icons } from './components/Icons' import { Separator } from './components/ui/separator' import { SidebarInset, SidebarProvider, SidebarTrigger } from './components/ui/sidebar' +import { Toaster } from './components/ui/sonner' export default function Layout() { return ( - - - -
-
- - - Forgery -
- - - -
-
- -
-
-
+ <> + + + +
+
+ + + Forgery +
+ + + +
+
+ +
+
+
+ + ) } diff --git a/src/ui/components/CreateLookDialog.tsx b/src/ui/components/CreateLookDialog.tsx index f19c00f..7ef8774 100644 --- a/src/ui/components/CreateLookDialog.tsx +++ b/src/ui/components/CreateLookDialog.tsx @@ -11,12 +11,12 @@ import { SaveOutfitDialog } from './SaveOutfitDialog' import { Badge } from './ui/badge' import { Button } from './ui/button' import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, } from './ui/dialog' import { Label } from './ui/label' import { ScrollArea, ScrollBar } from './ui/scroll-area' @@ -52,7 +52,6 @@ export const CreateLookDialog: React.FC = ({ const [selectedExpressionId, setSelectedExpressionId] = useState(null) const [userPrompt, setUserPrompt] = useState('') const [submitting, setSubmitting] = useState(false) - const [error, setError] = useState(null) const [loadOutfitOpen, setLoadOutfitOpen] = useState(false) const [saveOutfitOpen, setSaveOutfitOpen] = useState(false) @@ -143,7 +142,6 @@ export const CreateLookDialog: React.FC = ({ const handleCreate = async () => { if (selectedEquipments.length === 0) return setSubmitting(true) - setError(null) try { const res = await client.generations.$post({ @@ -167,7 +165,7 @@ export const CreateLookDialog: React.FC = ({ setUserPrompt('') } catch (e) { console.error(e) - setError(e instanceof Error ? e.message : 'Something went wrong') + toast.error(e instanceof Error ? e.message : 'Something went wrong') } finally { setSubmitting(false) } @@ -532,7 +530,6 @@ export const CreateLookDialog: React.FC = ({
- {error && {error}}