Chats: move messages fetch logic into ChatMessageList

better-thread-display
Alex Gleason 2020-09-04 18:08:53 -05:00
rodzic 9da87405f8
commit 8f1b11a394
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 3 dodań i 6 usunięć

Wyświetl plik

@ -5,7 +5,6 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import { injectIntl, defineMessages } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import {
fetchChatMessages,
sendChatMessage,
markChatRead,
} from 'soapbox/actions/chats';
@ -81,11 +80,6 @@ class ChatBox extends ImmutablePureComponent {
onSetInputRef(el);
};
componentDidMount() {
const { dispatch, chatId } = this.props;
dispatch(fetchChatMessages(chatId));
}
componentDidUpdate(prevProps) {
const markReadConditions = [
() => this.props.chat !== undefined,

Wyświetl plik

@ -80,6 +80,9 @@ class ChatMessageList extends ImmutablePureComponent {
}
componentDidMount() {
const { dispatch, chatId } = this.props;
dispatch(fetchChatMessages(chatId));
this.node.addEventListener('scroll', this.handleScroll);
}