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 04c965ffa8
commit 3b616aae4d
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -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;