feat(ui): only show canvas image fallback on loading error

This commit is contained in:
psychedelicious 2023-06-26 19:20:05 +10:00
parent 6390af229d
commit 6ccf62a863

View File

@ -9,10 +9,12 @@ type IAICanvasImageProps = {
};
const IAICanvasImage = (props: IAICanvasImageProps) => {
const { width, height, x, y, imageName } = props.canvasImage;
const { currentData: imageDTO } = useGetImageDTOQuery(imageName ?? skipToken);
const { currentData: imageDTO, isError } = useGetImageDTOQuery(
imageName ?? skipToken
);
const [image] = useImage(imageDTO?.image_url ?? '', 'anonymous');
if (!imageDTO) {
if (isError) {
return <Rect x={x} y={y} width={width} height={height} fill="red" />;
}