Skip to content

Commit

Permalink
Revert "persist last-intersected status update and restore when Scrol…
Browse files Browse the repository at this point in the history
…lableList is restored"

This reverts commit 07e2614.

accidentally merged spurious code in mastodon#12661.  mastodon#12735 removes the slowdown that this code was trying to solve; and other functionality successfully restores the view state of the list
  • Loading branch information
panarom committed Dec 31, 2019
1 parent 9edab7a commit fb1445a
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 27 deletions.
8 changes: 0 additions & 8 deletions app/javascript/mastodon/actions/timelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ export const TIMELINE_LOAD_PENDING = 'TIMELINE_LOAD_PENDING';
export const TIMELINE_DISCONNECT = 'TIMELINE_DISCONNECT';
export const TIMELINE_CONNECT = 'TIMELINE_CONNECT';

export const CURRENTLY_VIEWING = 'CURRENTLY_VIEWING';

export const updateCurrentlyViewing = (timeline, id) => ({
type: CURRENTLY_VIEWING,
timeline,
id,
});

export const loadPending = timeline => ({
type: TIMELINE_LOAD_PENDING,
timeline,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -50,8 +48,6 @@ export default class IntersectionObserverArticle extends React.Component {
);

this.componentMounted = true;

if(id === this.props.currentlyViewing) this.node.scrollIntoView();
}

componentWillUnmount () {
Expand All @@ -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);
}
Expand Down
4 changes: 0 additions & 4 deletions app/javascript/mastodon/components/scrollable_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/components/status_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { connect } from 'react-redux';
import StatusList from '../../../components/status_list';
import { scrollTopTimeline, loadPending, updateCurrentlyViewing } from '../../../actions/timelines';
import { scrollTopTimeline, loadPending } from '../../../actions/timelines';
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
import { createSelector } from 'reselect';
import { debounce } from 'lodash';
Expand Down Expand Up @@ -39,7 +39,6 @@ const makeMapStateToProps = () => {
isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false),
hasMore: state.getIn(['timelines', timelineId, 'hasMore']),
numPending: getPendingStatusIds(state, { type: timelineId }).size,
currentlyViewing: state.getIn(['timelines', timelineId, 'currentlyViewing'], -1),
});

return mapStateToProps;
Expand All @@ -57,7 +56,6 @@ const mapDispatchToProps = (dispatch, { timelineId }) => ({

onLoadPending: () => dispatch(loadPending(timelineId)),

updateCurrentlyViewing: id => dispatch(updateCurrentlyViewing(timelineId, id)),
});

export default connect(makeMapStateToProps, mapDispatchToProps)(StatusList);
4 changes: 0 additions & 4 deletions app/javascript/mastodon/reducers/timelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
TIMELINE_CONNECT,
TIMELINE_DISCONNECT,
TIMELINE_LOAD_PENDING,
CURRENTLY_VIEWING,
} from '../actions/timelines';
import {
ACCOUNT_BLOCK_SUCCESS,
Expand All @@ -29,7 +28,6 @@ const initialTimeline = ImmutableMap({
hasMore: true,
pendingItems: ImmutableList(),
items: ImmutableList(),
currentlyViewing: -1,
});

const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial, isLoadingRecent, usePendingItems) => {
Expand Down Expand Up @@ -170,8 +168,6 @@ export default function timelines(state = initialState, action) {
initialTimeline,
map => map.set('online', false).update(action.usePendingItems ? 'pendingItems' : 'items', items => items.first() ? items.unshift(null) : items)
);
case CURRENTLY_VIEWING:
return state.update(action.timeline, initialTimeline, map => map.set('currentlyViewing', action.id));
default:
return state;
}
Expand Down

0 comments on commit fb1445a

Please sign in to comment.