From b9fca9cae8b291105d95b252778cdeb6d5206d3c Mon Sep 17 00:00:00 2001 From: delvh Date: Tue, 4 Jul 2023 12:03:54 +0200 Subject: [PATCH 1/4] Prevent duplicate image loading Regression of #25672. --- web_src/js/features/imagediff.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web_src/js/features/imagediff.js b/web_src/js/features/imagediff.js index a26b927c33de6..28fec9cf8c47e 100644 --- a/web_src/js/features/imagediff.js +++ b/web_src/js/features/imagediff.js @@ -65,8 +65,9 @@ export function initImageDiff() { }; } - $('.image-diff').each(function() { + $('.image-diff:not([data-is-loaded-image])').each(function() { const $container = $(this); + $container.attr("data-is-loaded-image","true"); // the container may be hidden by "viewed" checkbox, so use the parent's width for reference const diffContainerWidth = Math.max($container.closest('.diff-file-box').width() - 300, 100); From 7d058194937efdf6f1b10712eccd723ce36b1b9a Mon Sep 17 00:00:00 2001 From: delvh Date: Tue, 4 Jul 2023 12:14:26 +0200 Subject: [PATCH 2/4] Fix lint --- web_src/js/features/imagediff.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/features/imagediff.js b/web_src/js/features/imagediff.js index 28fec9cf8c47e..6cce29364f0f4 100644 --- a/web_src/js/features/imagediff.js +++ b/web_src/js/features/imagediff.js @@ -67,7 +67,7 @@ export function initImageDiff() { $('.image-diff:not([data-is-loaded-image])').each(function() { const $container = $(this); - $container.attr("data-is-loaded-image","true"); + $container.attr('data-is-loaded-image', 'true'); // the container may be hidden by "viewed" checkbox, so use the parent's width for reference const diffContainerWidth = Math.max($container.closest('.diff-file-box').width() - 300, 100); From 08b8bf17dca8a94914d7e081852a6aa612f80449 Mon Sep 17 00:00:00 2001 From: delvh Date: Tue, 4 Jul 2023 14:00:01 +0200 Subject: [PATCH 3/4] Rename `data-is-loaded-image` -> `data-is-image-loaded` --- web_src/js/features/imagediff.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web_src/js/features/imagediff.js b/web_src/js/features/imagediff.js index 6cce29364f0f4..4ccbabccc02be 100644 --- a/web_src/js/features/imagediff.js +++ b/web_src/js/features/imagediff.js @@ -65,9 +65,9 @@ export function initImageDiff() { }; } - $('.image-diff:not([data-is-loaded-image])').each(function() { + $('.image-diff:not([data-is-image-loaded])').each(function() { const $container = $(this); - $container.attr('data-is-loaded-image', 'true'); + $container.attr('data-is-image-loaded', 'true'); // the container may be hidden by "viewed" checkbox, so use the parent's width for reference const diffContainerWidth = Math.max($container.closest('.diff-file-box').width() - 300, 100); From ee6911c582de5877c9892ae009dfe745e3a2d125 Mon Sep 17 00:00:00 2001 From: delvh Date: Tue, 4 Jul 2023 14:57:41 +0200 Subject: [PATCH 4/4] Next rename --- web_src/js/features/imagediff.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web_src/js/features/imagediff.js b/web_src/js/features/imagediff.js index 4ccbabccc02be..2e7baab79ff99 100644 --- a/web_src/js/features/imagediff.js +++ b/web_src/js/features/imagediff.js @@ -65,9 +65,9 @@ export function initImageDiff() { }; } - $('.image-diff:not([data-is-image-loaded])').each(function() { + $('.image-diff:not([data-image-diff-loaded])').each(function() { const $container = $(this); - $container.attr('data-is-image-loaded', 'true'); + $container.attr('data-image-diff-loaded', 'true'); // the container may be hidden by "viewed" checkbox, so use the parent's width for reference const diffContainerWidth = Math.max($container.closest('.diff-file-box').width() - 300, 100);