Timeline: Only call setIsNearBottom if value has changed
This commit is contained in:
parent
ff15a94f2f
commit
8fe73fa884
2 changed files with 6 additions and 1 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue