Removed updateScrollBottom on Status, ScrollableList (fixes feed jumping?)
• Removed: - updateScrollBottom on Status, ScrollableList (fixes feed jumping?)
This commit is contained in:
		
							parent
							
								
									9ba03d2c94
								
							
						
					
					
						commit
						859b4b5ca8
					
				@ -75,20 +75,6 @@ class ScrollableList extends React.PureComponent {
 | 
				
			|||||||
    this.handleScroll();
 | 
					    this.handleScroll();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getScrollPosition = () => {
 | 
					 | 
				
			||||||
    if (this.documentElement && (this.documentElement.scrollTop > 0 || this.mouseMovedRecently)) {
 | 
					 | 
				
			||||||
      return { height: this.documentElement.scrollHeight, top: this.documentElement.scrollTop };
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return null;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  updateScrollBottom = (snapshot) => {
 | 
					 | 
				
			||||||
    const newScrollTop = this.documentElement.scrollHeight - snapshot;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.setScrollTop(newScrollTop);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  componentDidUpdate(prevProps, prevState, snapshot) {
 | 
					  componentDidUpdate(prevProps, prevState, snapshot) {
 | 
				
			||||||
    // Reset the scroll position when a new child comes in in order not to
 | 
					    // Reset the scroll position when a new child comes in in order not to
 | 
				
			||||||
    // jerk the scrollbar around if you're already scrolled down the page.
 | 
					    // jerk the scrollbar around if you're already scrolled down the page.
 | 
				
			||||||
@ -247,8 +233,6 @@ class ScrollableList extends React.PureComponent {
 | 
				
			|||||||
                >
 | 
					                >
 | 
				
			||||||
                  {
 | 
					                  {
 | 
				
			||||||
                    React.cloneElement(child, {
 | 
					                    React.cloneElement(child, {
 | 
				
			||||||
                      getScrollPosition: this.getScrollPosition,
 | 
					 | 
				
			||||||
                      updateScrollBottom: this.updateScrollBottom,
 | 
					 | 
				
			||||||
                      cachedMediaWidth: this.state.cachedMediaWidth,
 | 
					                      cachedMediaWidth: this.state.cachedMediaWidth,
 | 
				
			||||||
                      cacheMediaWidth: this.cacheMediaWidth,
 | 
					                      cacheMediaWidth: this.cacheMediaWidth,
 | 
				
			||||||
                    })
 | 
					                    })
 | 
				
			||||||
 | 
				
			|||||||
@ -96,20 +96,6 @@ class Status extends ImmutablePureComponent {
 | 
				
			|||||||
    height: undefined,
 | 
					    height: undefined,
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Track height changes we know about to compensate scrolling
 | 
					 | 
				
			||||||
  componentDidMount() {
 | 
					 | 
				
			||||||
    const { isMuted, isHidden, status } = this.props
 | 
					 | 
				
			||||||
    this.didShowCard = !isMuted && !isHidden && status && status.get('card')
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  getSnapshotBeforeUpdate() {
 | 
					 | 
				
			||||||
    if (this.props.getScrollPosition) {
 | 
					 | 
				
			||||||
      return this.props.getScrollPosition()
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return null
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  static getDerivedStateFromProps(nextProps, prevState) {
 | 
					  static getDerivedStateFromProps(nextProps, prevState) {
 | 
				
			||||||
    if (nextProps.isChild) return null
 | 
					    if (nextProps.isChild) return null
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@ -131,7 +117,7 @@ class Status extends ImmutablePureComponent {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Compensate height changes
 | 
					  // Compensate height changes
 | 
				
			||||||
  componentDidUpdate(prevProps, prevState, snapshot) {
 | 
					  componentDidUpdate(prevProps, prevState) {
 | 
				
			||||||
    // timeline lazy loading comments
 | 
					    // timeline lazy loading comments
 | 
				
			||||||
    if (!prevState.loadedComments && this.state.loadedComments && this.props.status && !this.props.isChild && this.props.contextType !== 'feature') {
 | 
					    if (!prevState.loadedComments && this.state.loadedComments && this.props.status && !this.props.isChild && this.props.contextType !== 'feature') {
 | 
				
			||||||
      const commentCount = this.props.status.get('replies_count')
 | 
					      const commentCount = this.props.status.get('replies_count')
 | 
				
			||||||
@ -145,19 +131,6 @@ class Status extends ImmutablePureComponent {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    const doShowCard = !this.props.isMuted && !this.props.isHidden && this.props.status && this.props.status.get('card')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (doShowCard && !this.didShowCard) {
 | 
					 | 
				
			||||||
      this.didShowCard = true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (snapshot !== null && this.props.updateScrollBottom) {
 | 
					 | 
				
			||||||
        if (this.node && this.node.offsetTop < snapshot.top) {
 | 
					 | 
				
			||||||
          // console.log("updateScrollBottom")
 | 
					 | 
				
			||||||
          this.props.updateScrollBottom(snapshot.height - snapshot.top)
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  handleMoveUp = (id) => {
 | 
					  handleMoveUp = (id) => {
 | 
				
			||||||
@ -208,17 +181,6 @@ class Status extends ImmutablePureComponent {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  componentWillUnmount() {
 | 
					 | 
				
			||||||
    if (this.node && this.props.getScrollPosition) {
 | 
					 | 
				
			||||||
      const position = this.props.getScrollPosition()
 | 
					 | 
				
			||||||
      if (position !== null && this.node.offsetTop < position.top) {
 | 
					 | 
				
			||||||
        requestAnimationFrame(() => {
 | 
					 | 
				
			||||||
          this.props.updateScrollBottom(position.height - position.top)
 | 
					 | 
				
			||||||
        })
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  handleToggleMediaVisibility = () => {
 | 
					  handleToggleMediaVisibility = () => {
 | 
				
			||||||
    this.setState({ showMedia: !this.state.showMedia })
 | 
					    this.setState({ showMedia: !this.state.showMedia })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -621,8 +583,6 @@ Status.propTypes = {
 | 
				
			|||||||
  onMoveDown: PropTypes.func,
 | 
					  onMoveDown: PropTypes.func,
 | 
				
			||||||
  onFetchComments: PropTypes.func,
 | 
					  onFetchComments: PropTypes.func,
 | 
				
			||||||
  onFetchContext: PropTypes.func,
 | 
					  onFetchContext: PropTypes.func,
 | 
				
			||||||
  getScrollPosition: PropTypes.func,
 | 
					 | 
				
			||||||
  updateScrollBottom: PropTypes.func,
 | 
					 | 
				
			||||||
  cacheMediaWidth: PropTypes.func,
 | 
					  cacheMediaWidth: PropTypes.func,
 | 
				
			||||||
  cachedMediaWidth: PropTypes.number,
 | 
					  cachedMediaWidth: PropTypes.number,
 | 
				
			||||||
  contextType: PropTypes.string,
 | 
					  contextType: PropTypes.string,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user