mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
Hide image preview when it has an error in ToolCallDisplay
This commit is contained in:
2 files changed
+10
-2
No files matched your search
@@ -8,9 +8,10 @@ interface VFSImageProps {
|
||||
alt: string;
|
||||
className?: string;
|
||||
onClick?: () => void;
|
||||
onError?: (error: string) => void;
|
||||
}
|
||||
|
||||
export function VFSImage({ path, alt, className, onClick }: VFSImageProps) {
|
||||
export function VFSImage({ path, alt, className, onClick, onError }: VFSImageProps) {
|
||||
const { fs } = useFS();
|
||||
const [dataUri, setDataUri] = useState<string | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -58,8 +59,10 @@ export function VFSImage({ path, alt, className, onClick }: VFSImageProps) {
|
||||
}
|
||||
} catch (err) {
|
||||
if (isMounted) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to load image');
|
||||
const errorMessage = err instanceof Error ? err.message : 'Failed to load image';
|
||||
setError(errorMessage);
|
||||
setIsLoading(false);
|
||||
onError?.(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user