File tree Expand file tree Collapse file tree 1 file changed +30
-21
lines changed
src/search/components/input Expand file tree Collapse file tree 1 file changed +30
-21
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ type AISearchResultEventParams = {
4141 connectedEventId ?: string
4242}
4343
44+ const MAX_REFERENCES_TO_SHOW = 4
45+
4446export function AskAIResults ( {
4547 query,
4648 version,
@@ -389,27 +391,34 @@ export function AskAIResults({
389391 >
390392 { t ( 'search.ai.references' ) }
391393 </ ActionList . GroupHeading >
392- { references . map ( ( source , index ) => (
393- < ActionList . Item
394- sx = { {
395- marginLeft : '0px' ,
396- paddingLeft : '0px' ,
397- } }
398- key = { `reference-${ index } ` }
399- id = { `search-option-reference-${ index + referencesIndexOffset } ` }
400- role = "option"
401- tabIndex = { - 1 }
402- onSelect = { ( ) => {
403- referenceOnSelect ( source . url )
404- } }
405- active = { index + referencesIndexOffset === selectedIndex }
406- >
407- < ActionList . LeadingVisual aria-hidden = "true" >
408- < FileIcon />
409- </ ActionList . LeadingVisual >
410- { source . title }
411- </ ActionList . Item >
412- ) ) }
394+ { references
395+ . map ( ( source , index ) => {
396+ if ( index >= MAX_REFERENCES_TO_SHOW ) {
397+ return null
398+ }
399+ return (
400+ < ActionList . Item
401+ sx = { {
402+ marginLeft : '0px' ,
403+ paddingLeft : '0px' ,
404+ } }
405+ key = { `reference-${ index } ` }
406+ id = { `search-option-reference-${ index + referencesIndexOffset } ` }
407+ role = "option"
408+ tabIndex = { - 1 }
409+ onSelect = { ( ) => {
410+ referenceOnSelect ( source . url )
411+ } }
412+ active = { index + referencesIndexOffset === selectedIndex }
413+ >
414+ < ActionList . LeadingVisual aria-hidden = "true" >
415+ < FileIcon />
416+ </ ActionList . LeadingVisual >
417+ { source . title }
418+ </ ActionList . Item >
419+ )
420+ } )
421+ . filter ( Boolean ) }
413422 </ ActionList . Group >
414423 </ ActionList >
415424 </ >
You can’t perform that action at this time.
0 commit comments