From c4fc8a8aeffc644af48f08b800b1c72b418b7022 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Mon, 2 Feb 2026 20:53:11 -0800 Subject: [PATCH] fix overlayscrollbars init on loading state --- .../components/multi-select/virtual-multi-select.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/shared/components/multi-select/virtual-multi-select.tsx b/src/shared/components/multi-select/virtual-multi-select.tsx index bac10ec8e..8c0c8f90d 100644 --- a/src/shared/components/multi-select/virtual-multi-select.tsx +++ b/src/shared/components/multi-select/virtual-multi-select.tsx @@ -94,6 +94,13 @@ export function VirtualMultiSelect({ const { current: container } = listContainerRef; if (!container) return; + const isListVisible = !isLoading && stableOptions.length > 0; + + if (!isListVisible) { + osInstance()?.destroy(); + return; + } + const viewport = container.firstElementChild as HTMLElement; if (!viewport) return; @@ -105,7 +112,7 @@ export function VirtualMultiSelect({ }); return () => osInstance()?.destroy(); - }, [initialize, osInstance, stableOptions.length]); + }, [initialize, osInstance, isLoading, stableOptions.length]); const handleToggle = useCallback( (optionValue: string) => {