Fix channel-selector thumbnail not updating

Recently changed to `<OptimizedImg>`, which was assuming the `src` never changes.

dejavu ... we also hit this issue when implementing the `IntersectionObserver` lazy-loading.
This commit is contained in:
infinite-persistence 2021-07-21 16:37:29 +08:00
parent e138673d27
commit 6b2548cc49
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -89,7 +89,9 @@ function OptimizedImage(props: Props) {
} else { } else {
setOptimizedSrc(src); 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) { if (!src) {
return null; return null;