From 461d267574fdb6a4310856bbc9502d3a7e0fed8e Mon Sep 17 00:00:00 2001 From: diondiondion Date: Thu, 20 Nov 2025 16:14:58 +0100 Subject: [PATCH] Replace unsafe willReceiveProps in media_gallery --- app/javascript/mastodon/components/media_gallery.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/javascript/mastodon/components/media_gallery.jsx b/app/javascript/mastodon/components/media_gallery.jsx index 64250236d8b..1b0ee6d9588 100644 --- a/app/javascript/mastodon/components/media_gallery.jsx +++ b/app/javascript/mastodon/components/media_gallery.jsx @@ -242,11 +242,11 @@ class MediaGallery extends PureComponent { window.removeEventListener('resize', this.handleResize); } - UNSAFE_componentWillReceiveProps (nextProps) { - if (!is(nextProps.media, this.props.media) && nextProps.visible === undefined) { - this.setState({ visible: displayMedia !== 'hide_all' && !nextProps.sensitive || displayMedia === 'show_all' }); - } else if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) { - this.setState({ visible: nextProps.visible }); + componentDidUpdate (prevProps) { + if (!is(prevProps.media, this.props.media) && this.props.visible === undefined) { + this.setState({ visible: displayMedia !== 'hide_all' && !this.props.sensitive || displayMedia === 'show_all' }); + } else if (!is(prevProps.visible, this.props.visible) && this.props.visible !== undefined) { + this.setState({ visible: this.props.visible }); } }