Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d6a25d4
Create performance monitoring abstraction
germain-gg May 14, 2021
6804a26
Add performance data collection mechanism
germain-gg May 14, 2021
89832ef
Add data collection mechanism in end to end test suite
germain-gg May 14, 2021
cbf6457
Revert app url to use the default that CI relies on
germain-gg May 14, 2021
781c0dc
Refactor performance monitor to use instance pattern
germain-gg May 17, 2021
f3bebdb
remove unused import
germain-gg May 17, 2021
5b6c5aa
Fix comment typo
germain-gg May 17, 2021
07d7469
Start decryption process if needed
germain-gg May 18, 2021
bcbfbd5
Fix event start check
germain-gg May 19, 2021
282b9f9
Merge branch 'develop' into gsouquet/switch-rooms
germain-gg May 19, 2021
382a08b
Delete RoomView dead code
germain-gg May 19, 2021
8f945ce
Render nothin rather than an empty div
germain-gg May 19, 2021
cf8e497
prevent unwarranted RoomView re-render
germain-gg May 19, 2021
d362321
Simplify SenderProfile DOM structure
germain-gg May 20, 2021
171539d
Simplify EventTile structure
germain-gg May 20, 2021
f058fd8
Reduce amount of DOM nodes
germain-gg May 20, 2021
9e55f24
Remove extraenous DOM nodes
germain-gg May 20, 2021
229c4b9
use userGroups cached value to avoid re-render
germain-gg May 20, 2021
0f63098
Remove typo semicolon
germain-gg May 20, 2021
47e007e
batch load events in ReplyThread before adding them to the state
germain-gg May 21, 2021
5ba419d
split room header and header wrapper
germain-gg May 21, 2021
ccfd6ba
fix linting issues
germain-gg May 21, 2021
c428736
Update MessagePanel test to account for new DOM structure
germain-gg May 21, 2021
4851e96
Switch rooms documentation and polishing
germain-gg May 24, 2021
c7c6a81
Merge branch 'develop' into gsouquet/switch-rooms
germain-gg May 26, 2021
51d8806
Merge branch 'develop' into gsouquet/switch-rooms
germain-gg May 27, 2021
1a51ed9
Make breadcrumb animation run on the compositing layer
germain-gg May 28, 2021
d894cc6
Merge branch 'develop' into gsouquet/switch-rooms
germain-gg Jun 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions res/css/structures/_RoomView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ hr.mx_RoomView_myReadMarker {
position: relative;
top: -1px;
z-index: 1;
will-change: width;
transition: width 400ms easeinsine 1s, opacity 400ms easeinsine 1s;
width: 99%;
opacity: 1;
Expand Down
18 changes: 7 additions & 11 deletions res/css/views/rooms/_IRCLayout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ $irc-line-height: $font-18px;
.mx_EventTile_line {
.mx_EventTile_e2eIcon,
.mx_TextualEvent,
.mx_MTextBody,
.mx_ReplyThread_wrapper_empty {
.mx_MTextBody {
display: inline-block;
}
}
Expand Down Expand Up @@ -177,16 +176,13 @@ $irc-line-height: $font-18px;
.mx_SenderProfile_hover {
background-color: $primary-bg-color;
overflow: hidden;
display: flex;

> span {
display: flex;

> .mx_SenderProfile_name {
overflow: hidden;
text-overflow: ellipsis;
min-width: var(--name-width);
text-align: end;
}
> .mx_SenderProfile_name {
overflow: hidden;
text-overflow: ellipsis;
min-width: var(--name-width);
text-align: end;
}
}

Expand Down
6 changes: 3 additions & 3 deletions res/css/views/rooms/_RoomBreadcrumbs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ limitations under the License.
// first triggering the enter state with the newest breadcrumb off screen (-40px) then
// sliding it into view.
&.mx_RoomBreadcrumbs-enter {
margin-left: -40px; // 32px for the avatar, 8px for the margin
transform: translateX(-40px); // 32px for the avatar, 8px for the margin
}
&.mx_RoomBreadcrumbs-enter-active {
margin-left: 0;
transform: translateX(0);

// Timing function is as-requested by design.
// NOTE: The transition time MUST match the value passed to CSSTransition!
transition: margin-left 640ms cubic-bezier(0.66, 0.02, 0.36, 1);
transition: transform 640ms cubic-bezier(0.66, 0.02, 0.36, 1);
}

.mx_RoomBreadcrumbs_placeholder {
Expand Down
66 changes: 32 additions & 34 deletions src/components/structures/MessagePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,39 +645,37 @@ export default class MessagePanel extends React.Component {

// use txnId as key if available so that we don't remount during sending
ret.push(
<li
key={mxEv.getTxnId() || eventId}
ref={this._collectEventNode.bind(this, eventId)}
data-scroll-tokens={scrollToken}
>
<TileErrorBoundary mxEvent={mxEv}>
<EventTile
mxEvent={mxEv}
continuation={continuation}
isRedacted={mxEv.isRedacted()}
replacingEventId={mxEv.replacingEventId()}
editState={isEditing && this.props.editState}
onHeightChanged={this._onHeightChanged}
readReceipts={readReceipts}
readReceiptMap={this._readReceiptMap}
showUrlPreview={this.props.showUrlPreview}
checkUnmounting={this._isUnmounting}
eventSendStatus={mxEv.getAssociatedStatus()}
tileShape={this.props.tileShape}
isTwelveHour={this.props.isTwelveHour}
permalinkCreator={this.props.permalinkCreator}
last={last}
lastInSection={willWantDateSeparator}
lastSuccessful={isLastSuccessful}
isSelectedEvent={highlight}
getRelationsForEvent={this.props.getRelationsForEvent}
showReactions={this.props.showReactions}
layout={this.props.layout}
enableFlair={this.props.enableFlair}
showReadReceipts={this.props.showReadReceipts}
/>
</TileErrorBoundary>
</li>,
<TileErrorBoundary key={mxEv.getTxnId() || eventId} mxEvent={mxEv}>
<EventTile
as="li"
data-scroll-tokens={scrollToken}
ref={this._collectEventNode.bind(this, eventId)}
alwaysShowTimestamps={this.props.alwaysShowTimestamps}
mxEvent={mxEv}
continuation={continuation}
isRedacted={mxEv.isRedacted()}
replacingEventId={mxEv.replacingEventId()}
editState={isEditing && this.props.editState}
onHeightChanged={this._onHeightChanged}
readReceipts={readReceipts}
readReceiptMap={this._readReceiptMap}
showUrlPreview={this.props.showUrlPreview}
checkUnmounting={this._isUnmounting}
eventSendStatus={mxEv.getAssociatedStatus()}
tileShape={this.props.tileShape}
isTwelveHour={this.props.isTwelveHour}
permalinkCreator={this.props.permalinkCreator}
last={last}
lastInSection={willWantDateSeparator}
lastSuccessful={isLastSuccessful}
isSelectedEvent={highlight}
getRelationsForEvent={this.props.getRelationsForEvent}
showReactions={this.props.showReactions}
layout={this.props.layout}
enableFlair={this.props.enableFlair}
showReadReceipts={this.props.showReadReceipts}
/>
</TileErrorBoundary>,
);

return ret;
Expand Down Expand Up @@ -779,7 +777,7 @@ export default class MessagePanel extends React.Component {
}

_collectEventNode = (eventId, node) => {
this.eventNodes[eventId] = node;
this.eventNodes[eventId] = node?.ref?.current;
}

// once dynamic content in the events load, make the scrollPanel check the
Expand Down
19 changes: 17 additions & 2 deletions src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ import { objectHasDiff } from "../../utils/objects";
import SpaceRoomView from "./SpaceRoomView";
import { IOpts } from "../../createRoom";
import {replaceableComponent} from "../../utils/replaceableComponent";
import { omit } from 'lodash';
import UIStore from "../../stores/UIStore";

const DEBUG = false;
Expand Down Expand Up @@ -176,6 +177,7 @@ export interface IState {
statusBarVisible: boolean;
// We load this later by asking the js-sdk to suggest a version for us.
// This object is the result of Room#getRecommendedVersion()

upgradeRecommendation?: {
version: string;
needsUpgrade: boolean;
Expand Down Expand Up @@ -529,7 +531,20 @@ export default class RoomView extends React.Component<IProps, IState> {
}

shouldComponentUpdate(nextProps, nextState) {
return (objectHasDiff(this.props, nextProps) || objectHasDiff(this.state, nextState));
const hasPropsDiff = objectHasDiff(this.props, nextProps);

// React only shallow comparison and we only want to trigger
// a component re-render if a room requires an upgrade
const newUpgradeRecommendation = nextState.upgradeRecommendation || {}
Comment thread
germain-gg marked this conversation as resolved.

const state = omit(this.state, ['upgradeRecommendation']);
const newState = omit(nextState, ['upgradeRecommendation'])

const hasStateDiff =
objectHasDiff(state, newState) ||
(newUpgradeRecommendation.needsUpgrade === true)

return hasPropsDiff || hasStateDiff;
}

componentDidUpdate() {
Expand Down Expand Up @@ -812,7 +827,7 @@ export default class RoomView extends React.Component<IProps, IState> {
};

private onEvent = (ev) => {
if (ev.isBeingDecrypted() || ev.isDecryptionFailure() || ev.shouldAttemptDecryption()) return;
if (ev.isBeingDecrypted() || ev.isDecryptionFailure()) return;
this.handleEffects(ev);
};

Expand Down
25 changes: 0 additions & 25 deletions src/components/structures/TimelinePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import shouldHideEvent from '../../shouldHideEvent';
import EditorStateTransfer from '../../utils/EditorStateTransfer';
import {haveTileForEvent} from "../views/rooms/EventTile";
import {UIFeature} from "../../settings/UIFeature";
import {objectHasDiff} from "../../utils/objects";
import {replaceableComponent} from "../../utils/replaceableComponent";
import { arrayFastClone } from "../../utils/arrays";

Expand Down Expand Up @@ -265,30 +264,6 @@ class TimelinePanel extends React.Component {
}
}

shouldComponentUpdate(nextProps, nextState) {
if (objectHasDiff(this.props, nextProps)) {
if (DEBUG) {
console.group("Timeline.shouldComponentUpdate: props change");
console.log("props before:", this.props);
console.log("props after:", nextProps);
console.groupEnd();
}
return true;
}

if (objectHasDiff(this.state, nextState)) {
if (DEBUG) {
console.group("Timeline.shouldComponentUpdate: state change");
console.log("state before:", this.state);
console.log("state after:", nextState);
console.groupEnd();
}
return true;
}

return false;
}

componentWillUnmount() {
// set a boolean to say we've been unmounted, which any pending
// promises can use to throw away their results.
Expand Down
22 changes: 12 additions & 10 deletions src/components/structures/ToastContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default class ToastContainer extends React.Component<{}, IState> {
const totalCount = this.state.toasts.length;
const isStacked = totalCount > 1;
let toast;
let containerClasses;
if (totalCount !== 0) {
const topToast = this.state.toasts[0];
const {title, icon, key, component, className, props} = topToast;
Expand All @@ -79,16 +80,17 @@ export default class ToastContainer extends React.Component<{}, IState> {
</div>
<div className="mx_Toast_body">{React.createElement(component, toastProps)}</div>
</div>);
}

const containerClasses = classNames("mx_ToastContainer", {
"mx_ToastContainer_stacked": isStacked,
});

return (
<div className={containerClasses} role="alert">
{toast}
</div>
);
containerClasses = classNames("mx_ToastContainer", {
"mx_ToastContainer_stacked": isStacked,
});
}
return toast
? (
<div className={containerClasses} role="alert">
{toast}
</div>
)
: null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class AccessibleTooltipButton extends React.PureComponent<IToolti
tooltipClassName={classNames("mx_AccessibleTooltipButton_tooltip", tooltipClassName)}
label={tooltip || title}
yOffset={yOffset}
/> : <div />;
/> : null;
return (
<AccessibleButton
{...props}
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/elements/Flair.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default class Flair extends React.Component {

render() {
if (this.state.profiles.length === 0) {
return <span className="mx_Flair" />;
return null;
}
const avatars = this.state.profiles.map((profile, index) => {
return <FlairAvatar key={index} groupProfile={profile} />;
Expand Down
44 changes: 20 additions & 24 deletions src/components/views/elements/ReplyThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export default class ReplyThread extends React.Component {

static makeThread(parentEv, onHeightChanged, permalinkCreator, ref, layout) {
if (!ReplyThread.getParentEventId(parentEv)) {
return <div className="mx_ReplyThread_wrapper_empty" />;
return null;
}
return <ReplyThread
parentEv={parentEv}
Expand Down Expand Up @@ -269,36 +269,27 @@ export default class ReplyThread extends React.Component {
const {parentEv} = this.props;
// at time of making this component we checked that props.parentEv has a parentEventId
const ev = await this.getEvent(ReplyThread.getParentEventId(parentEv));

if (this.unmounted) return;

if (ev) {
const loadedEv = await this.getNextEvent(ev);
this.setState({
events: [ev],
}, this.loadNextEvent);
loadedEv,
loading: false,
});
} else {
this.setState({err: true});
}
}

async loadNextEvent() {
if (this.unmounted) return;
const ev = this.state.events[0];
const inReplyToEventId = ReplyThread.getParentEventId(ev);

if (!inReplyToEventId) {
this.setState({
loading: false,
});
return;
}

const loadedEv = await this.getEvent(inReplyToEventId);
if (this.unmounted) return;

if (loadedEv) {
this.setState({loadedEv});
} else {
this.setState({err: true});
async getNextEvent(ev) {
try {
const inReplyToEventId = ReplyThread.getParentEventId(ev);
return await this.getEvent(inReplyToEventId);
} catch (e) {
return null;
}
}

Expand Down Expand Up @@ -326,13 +317,18 @@ export default class ReplyThread extends React.Component {
this.initialize();
}

onQuoteClick() {
async onQuoteClick() {
const events = [this.state.loadedEv, ...this.state.events];

let loadedEv = null;
if (events.length > 0) {
loadedEv = await this.getNextEvent(events[0]);
}

this.setState({
loadedEv: null,
loadedEv,
events,
}, this.loadNextEvent);
});

dis.fire(Action.FocusComposer);
}
Expand Down
Loading