Disable RoomView animation and fix console.count

This commit is contained in:
Diego Mello 2022-12-06 18:23:59 -03:00
parent 654feb719c
commit 7b526fe700
2 changed files with 10 additions and 10 deletions

View File

@ -10,7 +10,7 @@ import ActivityIndicator from '../../../containers/ActivityIndicator';
import { MessageType, TAnyMessage, TMessageModel, TThreadMessageModel, TThreadModel } from '../../../definitions'; import { MessageType, TAnyMessage, TMessageModel, TThreadMessageModel, TThreadModel } from '../../../definitions';
import database from '../../../lib/database'; import database from '../../../lib/database';
import { compareServerVersion, debounce } from '../../../lib/methods/helpers'; import { compareServerVersion, debounce } from '../../../lib/methods/helpers';
import { animateNextTransition } from '../../../lib/methods/helpers/layoutAnimation'; // import { animateNextTransition } from '../../../lib/methods/helpers/layoutAnimation';
import log from '../../../lib/methods/helpers/log'; import log from '../../../lib/methods/helpers/log';
import EmptyRoom from '../EmptyRoom'; import EmptyRoom from '../EmptyRoom';
// @ts-ignore // @ts-ignore
@ -110,7 +110,7 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
this.unsubscribeFocus(); this.unsubscribeFocus();
} }
this.clearHighlightedMessageTimeout(); this.clearHighlightedMessageTimeout();
console.countReset(`${this.constructor.name}.render calls`); console.countReset(`${this.constructor.name}.render: ${this.props.tmid || this.props.rid} calls`);
} }
// clears previous highlighted message timeout, if exists // clears previous highlighted message timeout, if exists
@ -123,7 +123,7 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
query = async () => { query = async () => {
this.count += QUERY_SIZE; this.count += QUERY_SIZE;
const { rid, tmid, showMessageInMainThread, serverVersion, listRef } = this.props; const { rid, tmid, showMessageInMainThread, serverVersion } = this.props;
const db = database.active; const db = database.active;
// handle servers with version < 3.0.0 // handle servers with version < 3.0.0
@ -185,10 +185,10 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
if (this.mounted) { if (this.mounted) {
this.setState({ messages: data }); this.setState({ messages: data });
if (this.animated) { // if (this.animated) {
listRef.current?.prepareForLayoutAnimationRender(); // listRef.current?.prepareForLayoutAnimationRender();
animateNextTransition(); // animateNextTransition();
} // }
} else { } else {
// @ts-ignore // @ts-ignore
this.state.messages = data; this.state.messages = data;
@ -337,9 +337,9 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
}; };
render() { render() {
console.count(`${this.constructor.name}.render calls`);
const { rid, tmid, listRef, loading } = this.props; const { rid, tmid, listRef, loading } = this.props;
const { messages, refreshing, highlightedMessage } = this.state; const { messages, refreshing, highlightedMessage } = this.state;
console.count(`${this.constructor.name}.render: ${tmid || rid} calls`);
return ( return (
// FIXME: added context directly so we don't have to touch on withTheme's ref // FIXME: added context directly so we don't have to touch on withTheme's ref
<ThemeContext.Consumer> <ThemeContext.Consumer>

View File

@ -487,7 +487,7 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
EventEmitter.removeListener(KEY_COMMAND, this.handleCommands); EventEmitter.removeListener(KEY_COMMAND, this.handleCommands);
} }
EventEmitter.removeListener('ROOM_REMOVED', this.handleRoomRemoved); EventEmitter.removeListener('ROOM_REMOVED', this.handleRoomRemoved);
console.countReset(`${this.constructor.name}.render calls`); console.countReset(`${this.constructor.name}.render: ${this.tmid || room.rid} calls`);
} }
canForwardGuest = async () => { canForwardGuest = async () => {
@ -1526,10 +1526,10 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
}; };
render() { render() {
console.count(`${this.constructor.name}.render calls`);
const { room, loading } = this.state; const { room, loading } = this.state;
const { user, baseUrl, theme, navigation, Hide_System_Messages, width, serverVersion } = this.props; const { user, baseUrl, theme, navigation, Hide_System_Messages, width, serverVersion } = this.props;
const { rid, t } = room; const { rid, t } = room;
console.count(`${this.constructor.name}.render: ${this.tmid || rid} calls`);
let sysMes; let sysMes;
let bannerClosed; let bannerClosed;
let announcement; let announcement;