Timeline: Only call setIsNearBottom if value has changed

This commit is contained in:
Scott Nonnenberg 2019-09-03 13:06:17 -07:00 committed by Ken Powers
parent ff15a94f2f
commit 8fe73fa884
2 changed files with 6 additions and 1 deletions

View File

@ -25,6 +25,7 @@ export type PropsDataType = {
haveNewest: boolean;
haveOldest: boolean;
isLoadingMessages: boolean;
isNearBottom?: boolean;
items: Array<string>;
loadCountdownStart?: number;
messageHeightChangeIndex?: number;
@ -323,7 +324,9 @@ export class Timeline extends React.PureComponent<Props, State> {
setLoadCountdownStart(id, loadCountdownStart);
}
setIsNearBottom(id, isNearBottom);
if (isNearBottom !== this.props.isNearBottom) {
setIsNearBottom(id, isNearBottom);
}
this.setState({
atBottom,

View File

@ -351,6 +351,7 @@ export function _conversationMessagesSelector(
const {
heightChangeMessageIds,
isLoadingMessages,
isNearBottom,
loadCountdownStart,
messageIds,
metrics,
@ -393,6 +394,7 @@ export function _conversationMessagesSelector(
isLoadingMessages,
loadCountdownStart,
items,
isNearBottom,
messageHeightChangeIndex:
isNumber(messageHeightChangeIndex) && messageHeightChangeIndex >= 0
? messageHeightChangeIndex