Repository navigation
ScrollArea thumb not updating when the data loads dynamically. #7974
Replies: 1 comment
|
The remaining Let the inner list grow with the items and put the height constraint on the outer ScrollArea: <ScrollArea className="h-[300px]">
<CommandList className="max-h-none overflow-visible">
{/* Your existing CommandGroup / CommandItem children */}
</CommandList>
</ScrollArea>This assumes the usual shadcn ScrollArea wrapper, whose viewport fills the root. Alternatively, remove Why it matters: Radix observes its content wrapper's size to recalculate the thumb. Once the inner list reaches its max-height, appending items can increase the viewport's In the reduced example, adding 15 rows changed For infinite loading, also attach your scroll listener or intersection-observer root to the actual ScrollArea viewport rather than CommandList, since CommandList no longer scrolls independently. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have created a Combobox which fetches next page data when scrolling to the bottom, and I have used ScrollArea wrapped around CommandList. Now the problem is when a new data loads the scrollarea thumb doesn't update to adjust to the new size of the list.
I am not sure weather this is a issue or this is simply not possible.
I have slightly modified the CommandList component as well (removed overflow-x-hidden and overflow-y-auto):
Reproduced the bug here:
https://codesandbox.io/p/devbox/q3qzjk?migrateFrom=c8jdkn
All reactions