@@ -2,7 +2,7 @@ import { isChrome as isChromeFn } from '@ui5/webcomponents-react-base/Device';
22import { useSyncRef } from '@ui5/webcomponents-react-base/internal/hooks' ;
33import { clsx } from 'clsx' ;
44import type { MutableRefObject } from 'react' ;
5- import { forwardRef , useEffect , useRef } from 'react' ;
5+ import { forwardRef , useEffect , useMemo , useRef } from 'react' ;
66import { FlexBoxDirection } from '../../../enums/FlexBoxDirection.js' ;
77import { FlexBox } from '../../FlexBox/index.js' ;
88import type { ClassNames } from '../types/index.js' ;
@@ -15,14 +15,13 @@ interface VerticalScrollbarProps {
1515 classNames : ClassNames ;
1616}
1717
18- const isChrome = isChromeFn ( ) ;
19-
2018export const VerticalScrollbar = forwardRef < HTMLDivElement , VerticalScrollbarProps > ( ( props , ref ) => {
2119 const { internalRowHeight, tableRef, tableBodyHeight, scrollContainerRef, classNames } = props ;
2220 const hasHorizontalScrollbar = tableRef ?. current ?. offsetWidth !== tableRef ?. current ?. scrollWidth ;
2321 const horizontalScrollbarSectionStyles = clsx ( hasHorizontalScrollbar && classNames . bottomSection ) ;
2422 const [ componentRef , scrollbarRef ] = useSyncRef < HTMLDivElement > ( ref ) ;
2523 const contentRef = useRef < HTMLDivElement > ( null ) ;
24+ const isChrome = useMemo ( ( ) => isChromeFn ( ) , [ ] ) ;
2625
2726 // Force style recalculation to fix Chrome scrollbar-color bug (track height not updating correctly)
2827 useEffect ( ( ) => {
@@ -43,7 +42,7 @@ export const VerticalScrollbar = forwardRef<HTMLDivElement, VerticalScrollbarPro
4342
4443 requestAnimationFrame ( forceScrollbarUpdate ) ;
4544 }
46- } , [ tableBodyHeight , scrollContainerRef . current ?. scrollHeight , scrollbarRef ] ) ;
45+ } , [ tableBodyHeight , scrollContainerRef . current ?. scrollHeight , scrollbarRef , isChrome ] ) ;
4746
4847 return (
4948 < FlexBox
0 commit comments