Skip to content

Commit d412c67

Browse files
committed
Always update whenever content size changes
1 parent 7f57237 commit d412c67

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

packages/@react-aria/virtualizer/src/ScrollView.tsx

+1-11
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,7 @@ export function useScrollView(props: ScrollViewProps, ref: RefObject<HTMLElement
189189
// Update visible rect when the content size changes, in case scrollbars need to appear or disappear.
190190
let lastContentSize = useRef<Size | null>(null);
191191
useLayoutEffect(() => {
192-
if (!isUpdatingSize.current) {
193-
// Detect when scrollbar state might have changed.
194-
let prevShowX = lastContentSize.current?.width > state.width;
195-
let prevShowY = lastContentSize.current?.height > state.height;
196-
let curShowX = contentSize.width > state.width;
197-
let curShowY = contentSize.height > state.height;
198-
199-
if (lastContentSize.current && prevShowX === curShowX && prevShowY === curShowY) {
200-
return;
201-
}
202-
192+
if (!isUpdatingSize.current && (lastContentSize.current == null || !contentSize.equals(lastContentSize.current))) {
203193
// React doesn't allow flushSync inside effects, so queue a microtask.
204194
// We also need to wait until all refs are set (e.g. when passing a ref down from a parent).
205195
// If we are in an `act` environment, update immediately without a microtask so you don't need

0 commit comments

Comments
 (0)