Track performance of message sends
This commit is contained in:
parent
2d3b1918b3
commit
0ab09711a4
4 changed files with 44 additions and 13 deletions
|
@ -74,7 +74,11 @@ export type Props = {
|
|||
): unknown;
|
||||
onTextTooLong(): unknown;
|
||||
onPickEmoji(o: EmojiPickDataType): unknown;
|
||||
onSubmit(message: string, mentions: Array<BodyRangeType>): unknown;
|
||||
onSubmit(
|
||||
message: string,
|
||||
mentions: Array<BodyRangeType>,
|
||||
timestamp: number
|
||||
): unknown;
|
||||
getQuotedMessage(): unknown;
|
||||
clearQuotedMessage(): unknown;
|
||||
};
|
||||
|
@ -218,6 +222,7 @@ export const CompositionInput: React.ComponentType<Props> = props => {
|
|||
};
|
||||
|
||||
const submit = () => {
|
||||
const timestamp = Date.now();
|
||||
const quill = quillRef.current;
|
||||
|
||||
if (quill === undefined) {
|
||||
|
@ -226,8 +231,10 @@ export const CompositionInput: React.ComponentType<Props> = props => {
|
|||
|
||||
const [text, mentions] = getTextAndMentions();
|
||||
|
||||
window.log.info(`Submitting a message with ${mentions.length} mentions`);
|
||||
onSubmit(text, mentions);
|
||||
window.log.info(
|
||||
`CompositionInput: Submitting message ${timestamp} with ${mentions.length} mentions`
|
||||
);
|
||||
onSubmit(text, mentions, timestamp);
|
||||
};
|
||||
|
||||
if (inputApi) {
|
||||
|
|
|
@ -454,7 +454,7 @@ export class Message extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
public componentDidUpdate(prevProps: Props): void {
|
||||
const { canDeleteForEveryone, isSelected } = this.props;
|
||||
const { canDeleteForEveryone, isSelected, status, timestamp } = this.props;
|
||||
|
||||
this.startSelectedTimer();
|
||||
|
||||
|
@ -468,6 +468,19 @@ export class Message extends React.Component<Props, State> {
|
|||
if (canDeleteForEveryone !== prevProps.canDeleteForEveryone) {
|
||||
this.startDeleteForEveryoneTimer();
|
||||
}
|
||||
|
||||
if (
|
||||
prevProps.status === 'sending' &&
|
||||
(status === 'sent' ||
|
||||
status === 'delivered' ||
|
||||
status === 'read' ||
|
||||
status === 'viewed')
|
||||
) {
|
||||
const delta = Date.now() - timestamp;
|
||||
window.log.info(
|
||||
`Message.tsx: Rendered 'send complete' for message ${timestamp}; took ${delta}ms`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public checkForHeightChange(prevProps: Props): void {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue