From cb7e8f4910c82f156313aa43c5feb24f987696f6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 7 Jan 2026 15:05:14 +0000 Subject: [PATCH] Memoise ListView context (#31668) * Update npm non-major dependencies * Make types happier Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Memoise ListView context Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Discard changes to yarn.lock --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- src/components/utils/ListView.tsx | 15 +++++++++------ .../views/rooms/RoomListPanel/RoomList.tsx | 8 ++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/utils/ListView.tsx b/src/components/utils/ListView.tsx index 9df5b67e69..36b33186c9 100644 --- a/src/components/utils/ListView.tsx +++ b/src/components/utils/ListView.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com Please see LICENSE files in the repository root for full details. */ -import React, { useRef, type JSX, useCallback, useEffect, useState } from "react"; +import React, { useRef, type JSX, useCallback, useEffect, useState, useMemo } from "react"; import { type VirtuosoHandle, type ListRange, Virtuoso, type VirtuosoProps } from "react-virtuoso"; import { isModifiedKeyEvent, Key } from "../../Keyboard"; @@ -293,11 +293,14 @@ export function ListView(props: IListViewProps = { - tabIndexKey: tabIndexKey, - focused: isFocused, - context: props.context || ({} as Context), - }; + const listContext: ListContext = useMemo( + () => ({ + tabIndexKey: tabIndexKey, + focused: isFocused, + context: props.context || ({} as Context), + }), + [tabIndexKey, isFocused, props.context], + ); return ( ( + () => ({ spaceId: roomsResult.spaceId, filterKeys: roomsResult.filterKeys }), + [roomsResult.spaceId, roomsResult.filterKeys], + ); return (