Fix scroll handling with modals
This commit is contained in:
		
							parent
							
								
									6e3d5cbca2
								
							
						
					
					
						commit
						99f28c17de
					
				
					 5 changed files with 5 additions and 8 deletions
				
			
		|  | @ -265,8 +265,7 @@ class ScrollableList extends PureComponent { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   defaultShouldUpdateScroll = (prevRouterProps, { location }) => { |   defaultShouldUpdateScroll = (prevRouterProps, { location }) => { | ||||||
|     if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; |     return !(prevRouterProps?.location?.state?.mastodonModalKey || location.state?.mastodonModalKey); | ||||||
|     return !(location.state && location.state.mastodonModalOpen); |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   handleLoadPending = e => { |   handleLoadPending = e => { | ||||||
|  |  | ||||||
|  | @ -147,7 +147,7 @@ class StatusActionBar extends ImmutablePureComponent { | ||||||
| 
 | 
 | ||||||
|   handleOpen = () => { |   handleOpen = () => { | ||||||
|     let state = {...this.context.router.history.location.state}; |     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 }); |       this.context.router.history.replace(`/statuses/${this.props.status.get('id')}`, { mastodonBackSteps: (state.mastodonBackSteps || 0) + 1 }); | ||||||
|     } else { |     } else { | ||||||
|       state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1; |       state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1; | ||||||
|  |  | ||||||
|  | @ -41,7 +41,7 @@ export default class Mastodon extends React.PureComponent { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   shouldUpdateScroll (_, { location }) { |   shouldUpdateScroll (_, { location }) { | ||||||
|     return !(location.state && location.state.mastodonModalOpen); |     return !(location.state?.mastodonModalKey); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|  |  | ||||||
|  | @ -105,8 +105,7 @@ class AccountGallery extends ImmutablePureComponent { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   shouldUpdateScroll = (prevRouterProps, { location }) => { |   shouldUpdateScroll = (prevRouterProps, { location }) => { | ||||||
|     if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; |     return !(prevRouterProps?.location?.state?.mastodonModalKey || location.state?.mastodonModalKey); | ||||||
|     return !(location.state && location.state.mastodonModalOpen); |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   setColumnRef = c => { |   setColumnRef = c => { | ||||||
|  |  | ||||||
|  | @ -508,8 +508,7 @@ class Status extends ImmutablePureComponent { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   shouldUpdateScroll = (prevRouterProps, { location }) => { |   shouldUpdateScroll = (prevRouterProps, { location }) => { | ||||||
|     if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false; |     return !(prevRouterProps?.location?.state?.mastodonModalKey || location.state?.mastodonModalKey); | ||||||
|     return !(location.state && location.state.mastodonModalOpen); |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue