]> cat aescling's git repositories - mastodon.git/commitdiff
Fix scroll handling with modals
authorClaire <claire.github-309c@sitedethib.com>
Tue, 13 Jul 2021 09:07:16 +0000 (11:07 +0200)
committerClaire <claire.github-309c@sitedethib.com>
Tue, 13 Jul 2021 09:07:16 +0000 (11:07 +0200)
app/javascript/flavours/glitch/components/scrollable_list.js
app/javascript/flavours/glitch/components/status_action_bar.js
app/javascript/flavours/glitch/containers/mastodon.js
app/javascript/flavours/glitch/features/account_gallery/index.js
app/javascript/flavours/glitch/features/status/index.js

index cc8d9f1f31855fb9ae6142bba0852bf23e96a004..5d0a06561882c63264214ad5b461d0cded41417e 100644 (file)
@@ -265,8 +265,7 @@ class ScrollableList extends PureComponent {
   }
 
   defaultShouldUpdateScroll = (prevRouterProps, { location }) => {
-    if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false;
-    return !(location.state && location.state.mastodonModalOpen);
+    return !(prevRouterProps?.location?.state?.mastodonModalKey || location.state?.mastodonModalKey);
   }
 
   handleLoadPending = e => {
index 74bfd948ed9c52ec9ee554ce48ab5b04c8b978b4..206ae74c87f2f2b4933d1f35e722687f8dc4af92 100644 (file)
@@ -147,7 +147,7 @@ class StatusActionBar extends ImmutablePureComponent {
 
   handleOpen = () => {
     let state = {...this.context.router.history.location.state};
-    if (state.mastodonModalOpen) {
+    if (state.mastodonModalKey) {
       this.context.router.history.replace(`/statuses/${this.props.status.get('id')}`, { mastodonBackSteps: (state.mastodonBackSteps || 0) + 1 });
     } else {
       state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
index bcdd9b54eb3616f0a8ed0b1b8aaf97cf1642ec5b..131303fd32198a253e6d1ad30d936d4f22ae2207 100644 (file)
@@ -41,7 +41,7 @@ export default class Mastodon extends React.PureComponent {
   }
 
   shouldUpdateScroll (_, { location }) {
-    return !(location.state && location.state.mastodonModalOpen);
+    return !(location.state?.mastodonModalKey);
   }
 
   render () {
index 2a43d1ed22db1a8d023911055387688ef4f90176..83d6233561d8e8282290d7e198a60ec2e2a802e4 100644 (file)
@@ -105,8 +105,7 @@ class AccountGallery extends ImmutablePureComponent {
   }
 
   shouldUpdateScroll = (prevRouterProps, { location }) => {
-    if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false;
-    return !(location.state && location.state.mastodonModalOpen);
+    return !(prevRouterProps?.location?.state?.mastodonModalKey || location.state?.mastodonModalKey);
   }
 
   setColumnRef = c => {
index 513a6227ff3ae79b2f684acb4e4a44bb557b2d2b..230966f2a8bee83dd4c1bd1ecba345cef2184076 100644 (file)
@@ -508,8 +508,7 @@ class Status extends ImmutablePureComponent {
   }
 
   shouldUpdateScroll = (prevRouterProps, { location }) => {
-    if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false;
-    return !(location.state && location.state.mastodonModalOpen);
+    return !(prevRouterProps?.location?.state?.mastodonModalKey || location.state?.mastodonModalKey);
   }
 
   render () {