From 6b2548cc495f06d5a0224e0e7e3bda7dc6346164 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Wed, 21 Jul 2021 16:37:29 +0800 Subject: [PATCH] Fix channel-selector thumbnail not updating Recently changed to ``, which was assuming the `src` never changes. dejavu ... we also hit this issue when implementing the `IntersectionObserver` lazy-loading. --- ui/component/optimizedImage/view.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/component/optimizedImage/view.jsx b/ui/component/optimizedImage/view.jsx index 1cc8743f6..cd89bde67 100644 --- a/ui/component/optimizedImage/view.jsx +++ b/ui/component/optimizedImage/view.jsx @@ -89,7 +89,9 @@ function OptimizedImage(props: Props) { } else { setOptimizedSrc(src); } - }, []); // eslint-disable-line react-hooks/exhaustive-deps + // We only want to run this on (1) initial mount and (2) 'src' change. Nothing else. + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [src]); if (!src) { return null;