From 5dc03d005c584dcd4fe8de72eaae2265962d7f97 Mon Sep 17 00:00:00 2001 From: Yaroslav Kuznietsov Date: Wed, 22 Dec 2021 18:00:12 +0200 Subject: [PATCH] [Canvas] Repeat image bug with image height fixed. (#121497) * Fixed typo and increased performance. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../public/components/repeat_image_component.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/expression_repeat_image/public/components/repeat_image_component.tsx b/src/plugins/expression_repeat_image/public/components/repeat_image_component.tsx index 7da6735c6ce86..e837932b9469a 100644 --- a/src/plugins/expression_repeat_image/public/components/repeat_image_component.tsx +++ b/src/plugins/expression_repeat_image/public/components/repeat_image_component.tsx @@ -49,7 +49,7 @@ function createImageJSX(img: HTMLImageElement | null) { if (!img) { return null; } - const params = img.width > img.height ? { heigth: img.height } : { width: img.width }; + const params = img.width > img.height ? { height: img.height } : { width: img.width }; return ; } @@ -82,12 +82,14 @@ function RepeatImageComponent({ if (image) { setImageSize(image, size); - times(count, () => imagesToRender.push(createImageJSX(image))); + const imgJSX = createImageJSX(image); + times(count, () => imagesToRender.push(imgJSX)); } if (emptyImage) { setImageSize(emptyImage, size); - times(max - count, () => imagesToRender.push(createImageJSX(emptyImage))); + const imgJSX = createImageJSX(emptyImage); + times(max - count, () => imagesToRender.push(imgJSX)); } return (