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

This commit is contained in:
blessedcoolant 2023-06-26 21:40:10 +12:00 committed by GitHub
commit d905d0e42a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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" />;
}