Skip to content

Commit fb1445a

Browse files
committed
Revert "persist last-intersected status update and restore when ScrollableList 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
1 parent 9edab7a commit fb1445a

6 files changed

Lines changed: 1 addition & 27 deletions

File tree

app/javascript/mastodon/actions/timelines.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ export const TIMELINE_LOAD_PENDING = 'TIMELINE_LOAD_PENDING';
1717
export const TIMELINE_DISCONNECT = 'TIMELINE_DISCONNECT';
1818
export const TIMELINE_CONNECT = 'TIMELINE_CONNECT';
1919

20-
export const CURRENTLY_VIEWING = 'CURRENTLY_VIEWING';
21-
22-
export const updateCurrentlyViewing = (timeline, id) => ({
23-
type: CURRENTLY_VIEWING,
24-
timeline,
25-
id,
26-
});
27-
2820
export const loadPending = timeline => ({
2921
type: TIMELINE_LOAD_PENDING,
3022
timeline,

app/javascript/mastodon/components/intersection_observer_article.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ export default class IntersectionObserverArticle extends React.Component {
2020
cachedHeight: PropTypes.number,
2121
onHeightChange: PropTypes.func,
2222
children: PropTypes.node,
23-
currentlyViewing: PropTypes.number,
24-
updateCurrentlyViewing: PropTypes.func,
2523
};
2624

2725
state = {
@@ -50,8 +48,6 @@ export default class IntersectionObserverArticle extends React.Component {
5048
);
5149

5250
this.componentMounted = true;
53-
54-
if(id === this.props.currentlyViewing) this.node.scrollIntoView();
5551
}
5652

5753
componentWillUnmount () {
@@ -64,8 +60,6 @@ export default class IntersectionObserverArticle extends React.Component {
6460
handleIntersection = (entry) => {
6561
this.entry = entry;
6662

67-
if(entry.intersectionRatio > 0.75 && this.props.updateCurrentlyViewing) this.props.updateCurrentlyViewing(this.id);
68-
6963
scheduleIdleTask(this.calculateHeight);
7064
this.setState(this.updateStateAfterIntersection);
7165
}

app/javascript/mastodon/components/scrollable_list.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ export default class ScrollableList extends PureComponent {
3636
emptyMessage: PropTypes.node,
3737
children: PropTypes.node,
3838
bindToDocument: PropTypes.bool,
39-
currentlyViewing: PropTypes.number,
40-
updateCurrentlyViewing: PropTypes.func,
4139
};
4240

4341
static defaultProps = {
@@ -314,8 +312,6 @@ export default class ScrollableList extends PureComponent {
314312
listLength={childrenCount}
315313
intersectionObserverWrapper={this.intersectionObserverWrapper}
316314
saveHeightKey={trackScroll ? `${this.context.router.route.location.key}:${scrollKey}` : null}
317-
currentlyViewing={this.props.currentlyViewing}
318-
updateCurrentlyViewing={this.props.updateCurrentlyViewing}
319315
>
320316
{React.cloneElement(child, {
321317
getScrollPosition: this.getScrollPosition,

app/javascript/mastodon/components/status_list.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ export default class StatusList extends ImmutablePureComponent {
2626
emptyMessage: PropTypes.node,
2727
alwaysPrepend: PropTypes.bool,
2828
timelineId: PropTypes.string,
29-
currentlyViewing: PropTypes.number,
30-
updateCurrentlyViewing: PropTypes.func,
3129
};
3230

3331
static defaultProps = {

app/javascript/mastodon/features/ui/containers/status_list_container.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { connect } from 'react-redux';
22
import StatusList from '../../../components/status_list';
3-
import { scrollTopTimeline, loadPending, updateCurrentlyViewing } from '../../../actions/timelines';
3+
import { scrollTopTimeline, loadPending } from '../../../actions/timelines';
44
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
55
import { createSelector } from 'reselect';
66
import { debounce } from 'lodash';
@@ -39,7 +39,6 @@ const makeMapStateToProps = () => {
3939
isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false),
4040
hasMore: state.getIn(['timelines', timelineId, 'hasMore']),
4141
numPending: getPendingStatusIds(state, { type: timelineId }).size,
42-
currentlyViewing: state.getIn(['timelines', timelineId, 'currentlyViewing'], -1),
4342
});
4443

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

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

60-
updateCurrentlyViewing: id => dispatch(updateCurrentlyViewing(timelineId, id)),
6159
});
6260

6361
export default connect(makeMapStateToProps, mapDispatchToProps)(StatusList);

app/javascript/mastodon/reducers/timelines.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
TIMELINE_CONNECT,
1010
TIMELINE_DISCONNECT,
1111
TIMELINE_LOAD_PENDING,
12-
CURRENTLY_VIEWING,
1312
} from '../actions/timelines';
1413
import {
1514
ACCOUNT_BLOCK_SUCCESS,
@@ -29,7 +28,6 @@ const initialTimeline = ImmutableMap({
2928
hasMore: true,
3029
pendingItems: ImmutableList(),
3130
items: ImmutableList(),
32-
currentlyViewing: -1,
3331
});
3432

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

0 commit comments

Comments
 (0)