From 2ecf25daf8481e5fe1b3bd8af0d4bd99835ac6eb Mon Sep 17 00:00:00 2001 From: xO-Tx Date: Fri, 14 Apr 2023 18:38:15 +0000 Subject: [PATCH] [FIX] website: fix images loading on Images Wall masonry layout On Chrome, and while adding a new image to Images Wall snippet (on "masonry" layout), The layout adaptation method will remove the snippet content to reinsert new images. Sometimes, the appended images are invisible and not correctly loaded (only when Chrome cache is enabled). In this commit, we append a "clone" of each image to the snippet container to prevent this behaviour. opw-3240231 closes odoo/odoo#118658 X-original-commit: https://github.com/odoo/odoo/commit/0d43aec24baad6420e0fe150a9c19d33c0b74198 Signed-off-by: Quentin Smetz (qsm) --- .../website/static/src/snippets/s_image_gallery/options.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/snippets/s_image_gallery/options.js b/addons/website/static/src/snippets/s_image_gallery/options.js index 0b3f23f4df4..935011abe04 100644 --- a/addons/website/static/src/snippets/s_image_gallery/options.js +++ b/addons/website/static/src/snippets/s_image_gallery/options.js @@ -207,7 +207,10 @@ options.registry.gallery = options.Class.extend({ $lowest = $col; } }); - $lowest.append(imgs.shift()); + // Only on Chrome: appended images are sometimes invisible and not + // correctly loaded from cache, we use a clone of the image to force + // the loading. + $lowest.append(imgs.shift().cloneNode()); } }, /**