File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5454
5555 let displayedDocuments: DisplayedDocuments = searchCache [' ' ]
5656 $ : {
57- if (searchValue in searchCache ) {
58- displayedDocuments = searchCache [searchValue ]
57+ const currentSearch = searchValue .trim ()
58+ if (currentSearch in searchCache ) {
59+ displayedDocuments = searchCache [currentSearch ]
5960 } else {
60- const results: ScriptData [] = search .search (searchValue )
61+ const results: ScriptData [] = search .search (currentSearch )
6162 const sortedResults = results .sort ((a , b ) => a .name .localeCompare (b .name ))
6263 displayedDocuments = {
6364 items: new Set (results .map ((script : ScriptData ) => script .index )),
6465 first: sortedResults [0 ]?.index ?? - 1 ,
6566 last: sortedResults [sortedResults .length - 1 ]?.index ?? - 1 ,
6667 }
68+ searchCache [currentSearch ] = displayedDocuments
6769 }
6870 }
6971 $ : if (typeof window !== ' undefined' )
You can’t perform that action at this time.
0 commit comments