mirror of
https://github.com/mattermost/mattermost.git
synced 2026-04-13 21:17:49 -04:00
MM-67518/MM-67762 Attempt to fix keep-at-bottom logic and scrolling when loading older posts (#35866) (#35982)
Some checks failed
Server CI / Compute Go Version (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Server CI / Check mocks (push) Has been cancelled
Server CI / Check go mod tidy (push) Has been cancelled
Server CI / check-style (push) Has been cancelled
Server CI / Check serialization methods for hot structs (push) Has been cancelled
Server CI / Vet API (push) Has been cancelled
Server CI / Check migration files (push) Has been cancelled
Server CI / Generate email templates (push) Has been cancelled
Server CI / Check store layers (push) Has been cancelled
Server CI / Check mmctl docs (push) Has been cancelled
Server CI / Postgres with binary parameters (push) Has been cancelled
Server CI / Postgres (push) Has been cancelled
Server CI / Postgres (FIPS) (push) Has been cancelled
Server CI / Generate Test Coverage (push) Has been cancelled
Server CI / Run mmctl tests (push) Has been cancelled
Server CI / Run mmctl tests (FIPS) (push) Has been cancelled
Server CI / Build mattermost server app (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
Some checks failed
Server CI / Compute Go Version (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Server CI / Check mocks (push) Has been cancelled
Server CI / Check go mod tidy (push) Has been cancelled
Server CI / check-style (push) Has been cancelled
Server CI / Check serialization methods for hot structs (push) Has been cancelled
Server CI / Vet API (push) Has been cancelled
Server CI / Check migration files (push) Has been cancelled
Server CI / Generate email templates (push) Has been cancelled
Server CI / Check store layers (push) Has been cancelled
Server CI / Check mmctl docs (push) Has been cancelled
Server CI / Postgres with binary parameters (push) Has been cancelled
Server CI / Postgres (push) Has been cancelled
Server CI / Postgres (FIPS) (push) Has been cancelled
Server CI / Generate Test Coverage (push) Has been cancelled
Server CI / Run mmctl tests (push) Has been cancelled
Server CI / Run mmctl tests (FIPS) (push) Has been cancelled
Server CI / Build mattermost server app (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
Automatic Merge
This commit is contained in:
parent
440ad10671
commit
cc4ef6863e
1 changed files with 3 additions and 43 deletions
|
|
@ -132,9 +132,6 @@ type State = {
|
|||
postListIds: string[];
|
||||
topPostId: string;
|
||||
postMenuOpened: boolean;
|
||||
dynamicListStyle: {
|
||||
willChange: string;
|
||||
};
|
||||
initScrollCompleted: boolean;
|
||||
initScrollOffsetFromBottom: number;
|
||||
showSearchHint: boolean;
|
||||
|
|
@ -169,9 +166,6 @@ export default class PostList extends React.PureComponent<Props, State> {
|
|||
postListIds: [channelIntroMessage],
|
||||
topPostId: '',
|
||||
postMenuOpened: false,
|
||||
dynamicListStyle: {
|
||||
willChange: 'transform',
|
||||
},
|
||||
initScrollCompleted: false,
|
||||
initScrollOffsetFromBottom: 0,
|
||||
showSearchHint: false,
|
||||
|
|
@ -281,7 +275,7 @@ export default class PostList extends React.PureComponent<Props, State> {
|
|||
EventEmitter.removeListener(EventTypes.POST_LIST_SCROLL_TO_BOTTOM, this.scrollToLatestMessages);
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(props: Props, state: State) {
|
||||
static getDerivedStateFromProps(props: Props) {
|
||||
const postListIds = props.postListIds || [];
|
||||
let newPostListIds;
|
||||
|
||||
|
|
@ -305,25 +299,6 @@ export default class PostList extends React.PureComponent<Props, State> {
|
|||
postListIds: newPostListIds,
|
||||
};
|
||||
|
||||
if (props.isMobileView !== state.isMobileView) {
|
||||
nextState.isMobileView = props.isMobileView;
|
||||
|
||||
const dynamicListStyle = state.dynamicListStyle;
|
||||
if (state.postMenuOpened) {
|
||||
if (!props.isMobileView && dynamicListStyle.willChange === 'unset') {
|
||||
nextState.dynamicListStyle = {
|
||||
...dynamicListStyle,
|
||||
willChange: 'transform',
|
||||
};
|
||||
} else if (props.isMobileView && dynamicListStyle.willChange === 'transform') {
|
||||
nextState.dynamicListStyle = {
|
||||
...dynamicListStyle,
|
||||
willChange: 'unset',
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nextState;
|
||||
}
|
||||
|
||||
|
|
@ -332,17 +307,8 @@ export default class PostList extends React.PureComponent<Props, State> {
|
|||
};
|
||||
|
||||
togglePostMenu = (opened: boolean) => {
|
||||
let dynamicListStyle = this.state.dynamicListStyle;
|
||||
if (this.props.isMobileView) {
|
||||
dynamicListStyle = {
|
||||
...dynamicListStyle,
|
||||
willChange: opened ? 'unset' : 'transform',
|
||||
};
|
||||
}
|
||||
|
||||
this.setState({
|
||||
postMenuOpened: opened,
|
||||
dynamicListStyle,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -374,13 +340,9 @@ export default class PostList extends React.PureComponent<Props, State> {
|
|||
// Since the first in the list is the latest message
|
||||
const isLastPost = itemId === this.state.postListIds[0];
|
||||
|
||||
const isLoader = itemId === PostListRowListIds.OLDER_MESSAGES_LOADER || itemId === PostListRowListIds.NEWER_MESSAGES_LOADER;
|
||||
const shouldHideLoader = isLoader && !this.props.loadingOlderPosts && !this.props.loadingNewerPosts;
|
||||
const rowStyle = shouldHideLoader ? {...style, display: 'none'} : style;
|
||||
|
||||
return (
|
||||
<div
|
||||
style={rowStyle}
|
||||
style={style}
|
||||
className={className}
|
||||
>
|
||||
<PostListRow
|
||||
|
|
@ -693,8 +655,6 @@ export default class PostList extends React.PureComponent<Props, State> {
|
|||
};
|
||||
|
||||
render() {
|
||||
const {dynamicListStyle} = this.state;
|
||||
|
||||
return (
|
||||
<div
|
||||
className='a11y__region'
|
||||
|
|
@ -751,7 +711,7 @@ export default class PostList extends React.PureComponent<Props, State> {
|
|||
initScrollToIndex={this.initScrollToIndex}
|
||||
canLoadMorePosts={this.props.actions.canLoadMorePosts}
|
||||
innerRef={this.postListRef}
|
||||
style={{...virtListStyles, ...dynamicListStyle}}
|
||||
style={virtListStyles}
|
||||
innerListStyle={postListStyle}
|
||||
initRangeToRender={this.initRangeToRender}
|
||||
loaderId={PostListRowListIds.OLDER_MESSAGES_LOADER}
|
||||
|
|
|
|||
Loading…
Reference in a new issue