From a8501fb44dca6a655dced04c14c1117241bf5375 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 28 Aug 2021 15:17:28 +0200 Subject: [PATCH] Fix scroll position resetting when opening media modals in web UI --- app/soapbox/containers/soapbox.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/soapbox/containers/soapbox.js b/app/soapbox/containers/soapbox.js index 27f7ef614..8a0c327da 100644 --- a/app/soapbox/containers/soapbox.js +++ b/app/soapbox/containers/soapbox.js @@ -15,6 +15,8 @@ import UI from '../features/ui'; // import Introduction from '../features/introduction'; import { preload } from '../actions/preload'; import { IntlProvider } from 'react-intl'; +import { previewState as previewMediaState } from 'soapbox/features/ui/components/media_modal'; +import { previewState as previewVideoState } from 'soapbox/features/ui/components/video_modal'; import ErrorBoundary from '../components/error_boundary'; import { fetchInstance } from 'soapbox/actions/instance'; import { fetchSoapboxConfig } from 'soapbox/actions/soapbox'; @@ -104,6 +106,10 @@ class SoapboxMount extends React.PureComponent { this.maybeUpdateMessages(prevProps); } + shouldUpdateScroll(_, { location }) { + return location.state !== previewMediaState && location.state !== previewVideoState; + } + render() { const { me, themeCss, locale, customCss } = this.props; if (me === null) return null; @@ -137,7 +143,7 @@ class SoapboxMount extends React.PureComponent { - + {!me && }