FIX: check if dominant color is set before updating site theme color (#22658)

Currently the dominant color attribute is only set for post images (not chat).
As a result, clicking lightbox images in chat will load the image within lightbox but also shows a JS error.
This change ensures that the dominant color is set before attempting to update the site theme color.
This commit is contained in:
David Battersby 2023-07-18 12:14:58 +08:00 committed by GitHub
parent 72ea73988c
commit 3c1dd4a62c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -249,7 +249,9 @@ export default class DLightbox extends Component {
#onAfterItemChange() {
this.isLoading = false;
setSiteThemeColor(this.currentItem.dominantColor);
if (this.currentItem.dominantColor) {
setSiteThemeColor(this.currentItem.dominantColor);
}
setCarouselScrollPosition({
behavior: "smooth",