about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2020-08-17 13:53:52 +0200
committerThibG <thib@sitedethib.com>2020-08-17 15:46:18 +0200
commitd4b65193c76cbaf2d5353f33a451dc5e1e5c663c (patch)
tree08d7ce7c07118859fcc7df5b8aba030fce178dec
parente5dbdebc31e9f374606ce8a495e99e621fc8da5a (diff)
Fix WebUI crash in edge case when media display size causes scroll
Fixes #1406
-rw-r--r--app/javascript/flavours/glitch/components/media_gallery.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/app/javascript/flavours/glitch/components/media_gallery.js b/app/javascript/flavours/glitch/components/media_gallery.js
index 3a4839414..96042f07a 100644
--- a/app/javascript/flavours/glitch/components/media_gallery.js
+++ b/app/javascript/flavours/glitch/components/media_gallery.js
@@ -287,10 +287,8 @@ class MediaGallery extends React.PureComponent {
   }
 
   componentDidUpdate (prevProps) {
-    if (this.node && this.node.offsetWidth && this.node.offsetWidth != this.state.width) {
-      this.setState({
-        width: this.node.offsetWidth,
-      });
+    if (this.node) {
+      this.handleResize();
     }
   }