Skip to content

Commit

Permalink
feat(ui): only show canvas image fallback on loading error (#3589)
Browse files Browse the repository at this point in the history
  • Loading branch information
blessedcoolant authored Jun 26, 2023
2 parents 6390af2 + 6ccf62a commit d905d0e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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" />;
}

Expand Down

0 comments on commit d905d0e

Please sign in to comment.