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

Commit 3bbc867

Browse files
committed
Add a comment about why we're not using slice
1 parent b89847b commit 3bbc867

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/components/structures/MessagePanel.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,10 @@ const groupers = [CreationGrouper, MainGrouper];
14001400
* event that is >start items through the list, and is shown.
14011401
*/
14021402
function findFirstShownAfter(start: number, events: EventAndShouldShow[]): MatrixEvent | null {
1403+
// Note: this could be done with something like:
1404+
// events.slice(i + 1).find((e) => e.shouldShow)?.event ?? null;
1405+
// but it is ~10% slower, and this is on the critical path.
1406+
14031407
for (let n = start + 1; n < events.length; n++) {
14041408
const { event, shouldShow } = events[n];
14051409
if (shouldShow) {

0 commit comments

Comments
 (0)