File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
packages/webui/src/client/lib Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,34 @@ export function VirtualElement({
116
116
}
117
117
} , [ ref , inView , placeholderHeight ] )
118
118
119
+ // failsafe to ensure visible elements if resizing happens while scrolling
120
+ useEffect ( ( ) => {
121
+ if ( inView && ! isShowingChildren ) {
122
+ // If element is in view but showing placeholder, force show children
123
+ const forceShowTimeout = setTimeout ( ( ) => {
124
+ setIsShowingChildren ( true )
125
+ } , 400 )
126
+
127
+ return ( ) => {
128
+ clearTimeout ( forceShowTimeout )
129
+ }
130
+ }
131
+ } , [ inView , isShowingChildren ] )
132
+
133
+ useEffect ( ( ) => {
134
+ const checkVisibilityOnScroll = ( ) => {
135
+ if ( inView && ! isShowingChildren ) {
136
+ setIsShowingChildren ( true )
137
+ }
138
+ }
139
+
140
+ window . addEventListener ( 'scroll' , checkVisibilityOnScroll , { passive : true } )
141
+
142
+ return ( ) => {
143
+ window . removeEventListener ( 'scroll' , checkVisibilityOnScroll )
144
+ }
145
+ } , [ inView , isShowingChildren ] )
146
+
119
147
useEffect ( ( ) => {
120
148
if ( inView ) {
121
149
setIsShowingChildren ( true )
You can’t perform that action at this time.
0 commit comments