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;
|
haveNewest: boolean;
|
||||||
haveOldest: boolean;
|
haveOldest: boolean;
|
||||||
isLoadingMessages: boolean;
|
isLoadingMessages: boolean;
|
||||||
|
isNearBottom?: boolean;
|
||||||
items: Array<string>;
|
items: Array<string>;
|
||||||
loadCountdownStart?: number;
|
loadCountdownStart?: number;
|
||||||
messageHeightChangeIndex?: number;
|
messageHeightChangeIndex?: number;
|
||||||
|
@ -323,7 +324,9 @@ export class Timeline extends React.PureComponent<Props, State> {
|
||||||
setLoadCountdownStart(id, loadCountdownStart);
|
setLoadCountdownStart(id, loadCountdownStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsNearBottom(id, isNearBottom);
|
if (isNearBottom !== this.props.isNearBottom) {
|
||||||
|
setIsNearBottom(id, isNearBottom);
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
atBottom,
|
atBottom,
|
||||||
|
|
|
@ -351,6 +351,7 @@ export function _conversationMessagesSelector(
|
||||||
const {
|
const {
|
||||||
heightChangeMessageIds,
|
heightChangeMessageIds,
|
||||||
isLoadingMessages,
|
isLoadingMessages,
|
||||||
|
isNearBottom,
|
||||||
loadCountdownStart,
|
loadCountdownStart,
|
||||||
messageIds,
|
messageIds,
|
||||||
metrics,
|
metrics,
|
||||||
|
@ -393,6 +394,7 @@ export function _conversationMessagesSelector(
|
||||||
isLoadingMessages,
|
isLoadingMessages,
|
||||||
loadCountdownStart,
|
loadCountdownStart,
|
||||||
items,
|
items,
|
||||||
|
isNearBottom,
|
||||||
messageHeightChangeIndex:
|
messageHeightChangeIndex:
|
||||||
isNumber(messageHeightChangeIndex) && messageHeightChangeIndex >= 0
|
isNumber(messageHeightChangeIndex) && messageHeightChangeIndex >= 0
|
||||||
? messageHeightChangeIndex
|
? messageHeightChangeIndex
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue