Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Revert virtualised and auto load of posts #2622

Merged
merged 9 commits into from
Apr 8, 2019
Prev Previous commit
Next Next commit
Revert "MM-14820 Fix post menu on mobile view (#2576)"
This reverts commit 8bd8dda.
  • Loading branch information
sudheerDev committed Apr 5, 2019
commit 969121616e2ffa71b409bb42d282339e29cd573c
9 changes: 0 additions & 9 deletions components/post_view/post/post.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ export default class Post extends React.PureComponent {
*/
previousPostIsComment: PropTypes.bool,

/*
* Function called when the post options dropdown is opened
*/
togglePostMenu: PropTypes.func,

/**
* Set to render this comment as a mention
*/
Expand Down Expand Up @@ -103,10 +98,6 @@ export default class Post extends React.PureComponent {
}

handleDropdownOpened = (opened) => {
if (this.props.togglePostMenu) {
this.props.togglePostMenu(opened);
}

this.setState({
dropdownOpened: opened,
});
Expand Down
39 changes: 4 additions & 35 deletions components/post_view/post_list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ export default class PostList extends React.PureComponent {
postListIds: [channelIntroMessage],
postsObjById: {channelIntroMessage},
floatingTimestampDate: 0,
postMenuOpened: false,
dynamicListStyle: {
willChange: 'transform',
},
};

this.listRef = React.createRef();
Expand Down Expand Up @@ -201,20 +197,9 @@ export default class PostList extends React.PureComponent {

handleWindowResize = () => {
this.props.actions.checkAndSetMobileView();
const isMobile = Utils.isMobile();
if (isMobile !== this.state.isMobile) {
const dynamicListStyle = this.state.dynamicListStyle;
if (this.state.postMenuOpened) {
if (!isMobile && dynamicListStyle.willChange === 'unset') {
dynamicListStyle.willChange = 'transform';
} else if (isMobile && dynamicListStyle.willChange === 'transform') {
dynamicListStyle.willChange = 'unset';
}
}

if (Utils.isMobile() !== this.state.isMobile) {
this.setState({
isMobile,
dynamicListStyle,
isMobile: true,
});
this.scrollStopAction = new DelayedAction(this.handleScrollStop);
}
Expand All @@ -232,7 +217,7 @@ export default class PostList extends React.PureComponent {
if (this.mounted) {
this.setState({unViewedCount});
}
};
}

loadPosts = async (channelId, focusedPostId) => {
if (!channelId) {
Expand Down Expand Up @@ -289,19 +274,7 @@ export default class PostList extends React.PureComponent {
this.autoRetriesCount = 0;
}
}
};

togglePostMenu = (opened) => {
const dynamicListStyle = this.state.dynamicListStyle;
if (this.state.isMobile) {
dynamicListStyle.willChange = opened ? 'unset' : 'transform';
}

this.setState({
postMenuOpened: opened,
dynamicListStyle,
});
};
}

renderRow = ({itemId, style}) => {
return (
Expand All @@ -312,7 +285,6 @@ export default class PostList extends React.PureComponent {
shouldHighlight={itemId === this.props.focusedPostId}
post={this.props.postsObjById[itemId]}
loadMorePosts={this.loadMorePosts}
togglePostMenu={this.togglePostMenu}
/>
</div>
);
Expand Down Expand Up @@ -462,8 +434,6 @@ export default class PostList extends React.PureComponent {
);
}

const {dynamicListStyle} = this.state;

return (
<div id='post-list'>
{this.state.isMobile && (
Expand Down Expand Up @@ -509,7 +479,6 @@ export default class PostList extends React.PureComponent {
onNewItemsMounted={this.onNewItemsMounted}
canLoadMorePosts={this.canLoadMorePosts}
skipResizeClass='col__reply'
style={dynamicListStyle}
>
{this.renderRow}
</DynamicSizeList>
Expand Down
2 changes: 0 additions & 2 deletions components/post_view/post_list_row/post_list_row.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default class PostListRow extends React.PureComponent {
fullWidth: PropTypes.bool,
shouldHighlight: PropTypes.bool,
loadMorePosts: PropTypes.func,
togglePostMenu: PropTypes.func,
}

render() {
Expand All @@ -31,7 +30,6 @@ export default class PostListRow extends React.PureComponent {
key={'post ' + (post.id || post.pending_post_id)}
post={post}
shouldHighlight={this.props.shouldHighlight}
togglePostMenu={this.props.togglePostMenu}
/>
);
}
Expand Down
9 changes: 3 additions & 6 deletions components/widgets/menu/menu_wrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@ export default class MenuWrapper extends React.PureComponent {
if (this.node.current.contains(e.target)) {
return;
}

if (this.state.open) {
this.setState({open: false});
if (this.props.onToggle) {
this.props.onToggle(false);
}
this.setState({open: false});
if (this.props.onToggle) {
this.props.onToggle(false);
}
}

Expand Down