File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
packages/mgt-components/src/components/preview/mgt-search-results Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -533,8 +533,11 @@ export class MgtSearchResults extends MgtTemplatedComponent {
533533 const thumbnailBatch = graph . createBatch < BinaryThumbnail > ( ) ;
534534 const thumbnailBatchBeta = BetaGraph . fromGraph ( graph ) . createBatch < BinaryThumbnail > ( ) ;
535535
536- for ( let i = 0 ; i < response . value [ 0 ] . hitsContainers [ 0 ] . hits . length ; i ++ ) {
537- const element = response . value [ 0 ] . hitsContainers [ 0 ] . hits [ i ] ;
536+ const hits =
537+ response . value ?. length && response . value [ 0 ] . hitsContainers ?. length
538+ ? response . value [ 0 ] . hitsContainers [ 0 ] ?. hits ?? [ ]
539+ : [ ] ;
540+ for ( const element of hits ) {
538541 const resource = element . resource as SearchResource ;
539542 if (
540543 ( resource . size > 0 || resource . webUrl ?. endsWith ( '.aspx' ) ) &&
@@ -543,12 +546,12 @@ export class MgtSearchResults extends MgtTemplatedComponent {
543546 ) {
544547 if ( resource [ '@odata.type' ] === '#microsoft.graph.listItem' ) {
545548 thumbnailBatchBeta . get (
546- i . toString ( ) ,
549+ element . hitId . toString ( ) ,
547550 `/sites/${ resource . parentReference . siteId } /pages/${ resource . id } `
548551 ) ;
549552 } else {
550553 thumbnailBatch . get (
551- i . toString ( ) ,
554+ element . hitId . toString ( ) ,
552555 `/drives/${ resource . parentReference . driveId } /items/${ resource . id } /thumbnails/0/medium`
553556 ) ;
554557 }
You can’t perform that action at this time.
0 commit comments