Fix scroll positioning after viewing archive

Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2025-07-29 16:39:29 -05:00 committed by GitHub
parent 0a6a6d65ed
commit 2703416e4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 | List>(null);
useEffect(() => {
useLayoutEffect(() => {
const list = listRef.current;
if (shouldRecomputeRowHeights && list) {
list.recomputeRowHeights();
}
});
}, [shouldRecomputeRowHeights]);
const rowHeight = useCallback(
(index: Index) => calculateRowHeight(index.index),