@@ -319,11 +319,7 @@ const isDashboardNodeVisible = (node) => {
319319 }
320320 current = current . parentElement ;
321321 }
322- const rect = typeof node . getBoundingClientRect === 'function' ? node . getBoundingClientRect ( ) : null ;
323- if ( ! rect ) {
324- return false ;
325- }
326- return rect . width > 1 && rect . height > 1 ;
322+ return node . getClientRects ( ) . length > 0 ;
327323} ;
328324const isDashboardWidgetCollapsedForType = ( type ) => {
329325 const resolvedType = type === 'vm' ? 'vm' : 'docker' ;
@@ -332,28 +328,18 @@ const isDashboardWidgetCollapsedForType = (type) => {
332328 return true ;
333329 }
334330 const $updatedRow = getDashboardWidgetUpdatedRowForType ( resolvedType ) ;
335- if ( $updatedRow . length ) {
336- const updatedNode = $updatedRow . get ( 0 ) ;
337- const style = updatedNode ? window . getComputedStyle ( updatedNode ) : null ;
338- if ( style && ( style . display === 'none' || style . visibility === 'hidden' ) ) {
339- return true ;
340- }
341- const rect = updatedNode && typeof updatedNode . getBoundingClientRect === 'function'
342- ? updatedNode . getBoundingClientRect ( )
343- : null ;
344- if ( rect && ( rect . width < 8 || rect . height < 8 ) ) {
345- return true ;
346- }
347- }
348- const $headerRow = $tbody . children ( 'tr' ) . not ( '.updated' ) . first ( ) ;
349- const iconClass = String (
350- $headerRow . find ( 'a.switch i, .switch i' ) . first ( ) . attr ( 'class' )
351- || ''
352- ) . toLowerCase ( ) ;
353- if ( iconClass . includes ( 'angle-down' ) || iconClass . includes ( 'chevron-down' ) ) {
331+ if ( ! $updatedRow . length ) {
332+ return true ;
333+ }
334+ const updatedNode = $updatedRow . get ( 0 ) ;
335+ if ( ! updatedNode ) {
336+ return true ;
337+ }
338+ const style = window . getComputedStyle ( updatedNode ) ;
339+ if ( ! style || style . display === 'none' || style . visibility === 'hidden' ) {
354340 return true ;
355341 }
356- return false ;
342+ return ! isDashboardNodeVisible ( updatedNode ) ;
357343} ;
358344const getFirstVisibleDashboardFolderCardForType = ( type ) => {
359345 const $cards = getDashboardFolderCardsForType ( type ) ;
0 commit comments