From 1bb4bc370c62af5d8209e3098f0601f189e25b2d Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Tue, 29 Jul 2025 16:39:21 -0500 Subject: [PATCH] Fix scroll positioning after viewing archive Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com> --- ts/components/ListView.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ts/components/ListView.tsx b/ts/components/ListView.tsx index 6fee9cee86..5e62e7cc7d 100644 --- a/ts/components/ListView.tsx +++ b/ts/components/ListView.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import classNames from 'classnames'; -import React, { useEffect, useRef, useCallback, useMemo } from 'react'; +import React, { useRef, useCallback, useMemo, useLayoutEffect } from 'react'; import type { Index, ListRowRenderer } from 'react-virtualized'; import { List } from 'react-virtualized'; import { ScrollBehavior } from '../types/Util'; @@ -38,12 +38,12 @@ export function ListView({ }: Props): JSX.Element { const listRef = useRef(null); - useEffect(() => { + useLayoutEffect(() => { const list = listRef.current; if (shouldRecomputeRowHeights && list) { list.recomputeRowHeights(); } - }); + }, [shouldRecomputeRowHeights]); const rowHeight = useCallback( (index: Index) => calculateRowHeight(index.index),