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

MM-24351 Update react virt list to be based on new library #5399

Merged
merged 6 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import AutoSizer from 'react-virtualized-auto-sizer';
import {DynamicSizeList} from 'react-window';
import {DynamicSizeList} from 'dynamic-virtualized-list';
import {injectIntl} from 'react-intl';

import {isDateLine, isStartOfNewMessages} from 'mattermost-redux/utils/post_list';
Expand All @@ -22,9 +22,9 @@ import PostListRow from 'components/post_view/post_list_row';
import ScrollToBottomArrows from 'components/post_view/scroll_to_bottom_arrows';
import ToastWrapper from 'components/toast_wrapper';

const OVERSCAN_COUNT_BACKWARD = window.OVERSCAN_COUNT_BACKWARD || 80; // Exposing the value for PM to test will be removed soon
const OVERSCAN_COUNT_FORWARD = window.OVERSCAN_COUNT_FORWARD || 80; // Exposing the value for PM to test will be removed soon
const HEIGHT_TRIGGER_FOR_MORE_POSTS = window.HEIGHT_TRIGGER_FOR_MORE_POSTS || 1000; // Exposing the value for PM to test will be removed soon
const OVERSCAN_COUNT_BACKWARD = 80;
const OVERSCAN_COUNT_FORWARD = 80;
const HEIGHT_TRIGGER_FOR_MORE_POSTS = 1000;
const BUFFER_TO_BE_CONSIDERED_BOTTOM = 10;

const MAXIMUM_POSTS_FOR_SLICING = {
Expand Down Expand Up @@ -318,11 +318,6 @@ class PostList extends React.PureComponent {
);
};

itemKey = (index) => {
const {postListIds} = this.state;
return postListIds[index] ? postListIds[index] : index;
}

scrollToFailed = (index) => {
if (index === 0) {
this.props.actions.changeUnreadChunkTimeStamp('');
Expand Down Expand Up @@ -574,15 +569,12 @@ class PostList extends React.PureComponent {
height={height}
width={width}
className='post-list__dynamic'
itemCount={this.state.postListIds.length}
itemData={this.state.postListIds}
itemKey={this.itemKey}
overscanCountForward={OVERSCAN_COUNT_FORWARD}
overscanCountBackward={OVERSCAN_COUNT_BACKWARD}
onScroll={this.onScroll}
initScrollToIndex={this.initScrollToIndex}
canLoadMorePosts={this.props.actions.canLoadMorePosts}
skipResizeClass='post-menu'
innerRef={this.postListRef}
style={{...virtListStyles, ...dynamicListStyle}}
innerListStyle={postListStyle}
Expand Down
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"react-select": "2.4.4",
"react-transition-group": "4.3.0",
"react-virtualized-auto-sizer": "1.0.2",
"react-window": "github:mattermost/react-window#e5f498b143ebbe5ed64f82c454fd5937e3a00004",
"dynamic-virtualized-list": "github:mattermost/dynamic-virtualized-list#0b1530d8f060db317dd07f1fa7c7faf362cb7eae",
"rebound": "0.1.0",
"redux": "4.0.4",
"redux-batched-actions": "0.4.1",
Expand Down