Improve permalink performance#2671
Conversation
turt2live
left a comment
There was a problem hiding this comment.
Overall structure looks sane, just a few comments regarding the algorithm
| eventSendStatus={mxEv.status} | ||
| tileShape={this.props.tileShape} | ||
| isTwelveHour={this.props.isTwelveHour} | ||
| permaLinkCreator={this.props.permaLinkCreator} |
There was a problem hiding this comment.
extremely non-consequential nit: permalink is one word
|
|
||
| _updateHighestPlUser() { | ||
| const plEvent = this._room.currentState.getStateEvents("m.room.power_levels", ""); | ||
| const content = plEvent.getContent(); |
There was a problem hiding this comment.
something I ran into with Settings is that the power levels event might not exist. A null check here would prevent React from exploding
| }, [null, 0]); | ||
| const [userId, powerLevel] = maxEntry; | ||
| // object wasn't empty, and max entry wasn't a demotion from the default | ||
| if (userId !== null && powerLevel > (content.users_default || 0)) { |
There was a problem hiding this comment.
should be >= 50 - we intentionally don't check if they have > state_default and definitely don't want people who are low in the power level department.
(the comment block at the top explains why)
| const parser = document.createElement('a'); | ||
| parser.href = "https://" + domain; | ||
| return parser.hostname; | ||
| return new URL(`https://${domain}`).hostname; |
There was a problem hiding this comment.
There was a reason why this wasn't using the URL constructor, but I can't remember why :(
There was a problem hiding this comment.
It's well supported fwiw ... https://caniuse.com/#search=url Node also has it.
There was a problem hiding this comment.
Happy to put it back in if you think it will break stuff though.
There was a problem hiding this comment.
It had something to do with how it parsed stuff and not working in electron, but evidently all those concerns don't exist anymore. It should be fine like this.
|
Thanks for the review! Should be ready for another look. |
|
(also in future please hit the "request review" button because I have a tenancy to lose these sorts of things in the depths of my notifications) |
Arhhg, I keep forgetting this, sorry! Will try to be mindful of it. |
a24b973 to
137bda4
Compare
so we don't need to iterate over all members for every permalink
137bda4 to
77f979e
Compare
After the permalink API was changed in matrix-org#2671, it seems we forgot to update this call site, so it was creating `<room>/<room>` links, instead of `<room>/<event>`. Fixes element-hq/element-web#9110
After the permalink API was changed in matrix-org#2671, it seems we forgot to update this call site, so it was creating `<room>/<room>` links, instead of `<room>/<event>`. Fixes element-hq/element-web#9110
While profiling for element-hq/element-web#8565, I noticed creating event permalinks in
EventTile::rendertook 25ms in a room of 6k members. Paginating in 20 event tiles freezes the UI for 1.2 seconds in this case, so I thought it made sense to solve this first as any other improvements in this area would be unnoticeable.The solution is to make the permalink code track changes in the room and update the server candidates only when needed.