Fix 12661 (#12744)
* Revert "persist last-intersected status update and restore when ScrollableList is restored" This reverts commit 07e26142ef6a8e74bd2ac5e9b461a5a1699bd4c8. accidentally merged spurious code in https://github.com/tootsuite/mastodon/pull/12661. https://github.com/tootsuite/mastodon/pull/12735 removes the slowdown that this code was trying to solve; and other functionality successfully restores the view state of the list * Revert "cache currently-viewing status id to avoid calling redux with identical value" This reverts commit c93df2159fbd3888a5c48d8a8b8ae61dbbc54b89. accidentally merged spurious code in https://github.com/tootsuite/mastodon/pull/12661. https://github.com/tootsuite/mastodon/pull/12735 removes the slowdown that this code was trying to solve; and other functionality successfully restores the view state of the list
This commit is contained in:
committed by
Eugen Rochko
parent
aa138ea350
commit
9cbbc50fcd
@ -20,8 +20,6 @@ export default class IntersectionObserverArticle extends React.Component {
|
||||
cachedHeight: PropTypes.number,
|
||||
onHeightChange: PropTypes.func,
|
||||
children: PropTypes.node,
|
||||
currentlyViewing: PropTypes.number,
|
||||
updateCurrentlyViewing: PropTypes.func,
|
||||
};
|
||||
|
||||
state = {
|
||||
@ -50,8 +48,6 @@ export default class IntersectionObserverArticle extends React.Component {
|
||||
);
|
||||
|
||||
this.componentMounted = true;
|
||||
|
||||
if(id === this.props.currentlyViewing) this.node.scrollIntoView();
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
@ -64,8 +60,6 @@ export default class IntersectionObserverArticle extends React.Component {
|
||||
handleIntersection = (entry) => {
|
||||
this.entry = entry;
|
||||
|
||||
if(entry.intersectionRatio > 0.75 && this.props.updateCurrentlyViewing) this.props.updateCurrentlyViewing(this.id);
|
||||
|
||||
scheduleIdleTask(this.calculateHeight);
|
||||
this.setState(this.updateStateAfterIntersection);
|
||||
}
|
||||
|
@ -36,8 +36,6 @@ export default class ScrollableList extends PureComponent {
|
||||
emptyMessage: PropTypes.node,
|
||||
children: PropTypes.node,
|
||||
bindToDocument: PropTypes.bool,
|
||||
currentlyViewing: PropTypes.number,
|
||||
updateCurrentlyViewing: PropTypes.func,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
@ -314,8 +312,6 @@ export default class ScrollableList extends PureComponent {
|
||||
listLength={childrenCount}
|
||||
intersectionObserverWrapper={this.intersectionObserverWrapper}
|
||||
saveHeightKey={trackScroll ? `${this.context.router.route.location.key}:${scrollKey}` : null}
|
||||
currentlyViewing={this.props.currentlyViewing}
|
||||
updateCurrentlyViewing={this.props.updateCurrentlyViewing}
|
||||
>
|
||||
{React.cloneElement(child, {
|
||||
getScrollPosition: this.getScrollPosition,
|
||||
|
@ -26,8 +26,6 @@ export default class StatusList extends ImmutablePureComponent {
|
||||
emptyMessage: PropTypes.node,
|
||||
alwaysPrepend: PropTypes.bool,
|
||||
timelineId: PropTypes.string,
|
||||
currentlyViewing: PropTypes.number,
|
||||
updateCurrentlyViewing: PropTypes.func,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
@ -60,12 +58,6 @@ export default class StatusList extends ImmutablePureComponent {
|
||||
this.props.onLoadMore(this.props.statusIds.size > 0 ? this.props.statusIds.last() : undefined);
|
||||
}, 300, { leading: true })
|
||||
|
||||
updateCurrentlyViewingWithCache = (id) => {
|
||||
if(this.cachedCurrentlyViewing === id) return;
|
||||
this.cachedCurrentlyViewing = id;
|
||||
this.props.updateCurrentlyViewing(id);
|
||||
}
|
||||
|
||||
_selectChild (index, align_top) {
|
||||
const container = this.node.node;
|
||||
const element = container.querySelector(`article:nth-of-type(${index + 1}) .focusable`);
|
||||
@ -87,7 +79,6 @@ export default class StatusList extends ImmutablePureComponent {
|
||||
render () {
|
||||
const { statusIds, featuredStatusIds, shouldUpdateScroll, onLoadMore, timelineId, ...other } = this.props;
|
||||
const { isLoading, isPartial } = other;
|
||||
other.updateCurrentlyViewing = this.updateCurrentlyViewingWithCache;
|
||||
|
||||
if (isPartial) {
|
||||
return <RegenerationIndicator />;
|
||||
|
Reference in New Issue
Block a user