Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Conversation

t3chguy
Copy link
Member

@t3chguy t3chguy commented Sep 12, 2019

Fixes element-hq/element-web#8830
Fixes element-hq/element-web#1269

room_create_els

(blocked until post-privacy release or until we feel comfortable with React 16 internals not bricking our app)

@t3chguy
Copy link
Member Author

t3chguy commented Sep 12, 2019

Tests don't support hooks, needs changes

@t3chguy

This comment has been minimized.

@t3chguy t3chguy removed the blocked label Oct 1, 2019
@t3chguy t3chguy requested a review from a team October 1, 2019 11:24
}

const summarisedEvents = []; // Don't add m.room.create here as we don't want it inside the summary
for (;i + 1 < this.props.events.length; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, you've copied the pattern of advancing the outer for-loop counter in an inner for-loop from below, but it's a bit gnarly. I think this will only work because m.room.create events will only ever be at the start - otherwise it would break for an m.room.create after an aggregated member list because we'd have already done that check for a different event by the time we got to the second summarise loop. Not to mention that it makes the outer for loop rather long.

Would like at least a comment on the above assumption that makes this work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not to mention that it makes the outer for loop rather long.

Agreed, but I don't see any quick wins here without rewriting the outer loop entirely

otherwise it would break for an m.room.create after an aggregated member list because we'd have already done that check for a different event by the time we got to the second summarise loop

I can't picture this failure mode

Which check do you mean by

that check

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry - by, 'that check' I mean if (mxEv.getType() === "m.room.create") { - where if we're processing member events (if (isMembershipChange(mxEv) && wantTile) {) and find the end of them, we'll then not run the if (mxEv.getType() === "m.room.create") { check on the event after this member events. This happens to be OK because m.room.create events will never come after member events, but I can see someone c+ping this loop again for different event types.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this method is getting very long. Perhaps a good quick win would be to put both the room-create-collapse loop and the membership-collapse loop each in their own method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bwindels can't put them cleanly in their own method due to their side-effect on the iterator of their parent loop, unless the method signature would be something like
i = groupX(i, events) which is not a very readable thing

@lampholder lampholder requested a review from dbkr October 7, 2019 16:04
@bwindels bwindels requested review from bwindels and removed request for dbkr October 9, 2019 08:16
Copy link
Contributor

@bwindels bwindels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One suggested cleanup that can go into another PR if we want this in todays RC, and one question about what looks like a bad merge?

}

const summarisedEvents = []; // Don't add m.room.create here as we don't want it inside the summary
for (;i + 1 < this.props.events.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this method is getting very long. Perhaps a good quick win would be to put both the room-create-collapse loop and the membership-collapse loop each in their own method?

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
@bwindels bwindels force-pushed the t3chguy/nvl/react16/EventListSummary branch from 1193294 to f2d7379 Compare October 9, 2019 10:52
@bwindels
Copy link
Contributor

bwindels commented Oct 9, 2019

Rebased to resolve conflicts

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
@t3chguy
Copy link
Member Author

t3chguy commented Oct 9, 2019

I think @turt2live mentioned that pulling in base changes from develop is preferred to rebasing as the latter discards the effort of prior reviews

@t3chguy t3chguy merged commit 6e33cc0 into develop Oct 11, 2019
@t3chguy t3chguy deleted the t3chguy/nvl/react16/EventListSummary branch April 27, 2020 18:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants