@@ -48,10 +48,8 @@ const useSearchedSandboxes = (query: string) => {
4848} ;
4949
5050const calculateSearchIndex = ( dashboard : any , activeTeam : string ) => {
51- const sandboxes = dashboard . sandboxes . SEARCH ;
52- if ( sandboxes == null ) {
53- return null ;
54- }
51+ const sandboxes = dashboard . sandboxes . SEARCH || [ ] ;
52+
5553 const folders : Collection [ ] = ( dashboard . allCollections || [ ] )
5654 . map ( collection => ( {
5755 ...collection ,
@@ -60,7 +58,7 @@ const calculateSearchIndex = (dashboard: any, activeTeam: string) => {
6058 . filter ( f => f . title ) ;
6159
6260 const teamRepos = dashboard . repositoriesByTeamId [ activeTeam ] ?? [ ] ;
63- const repositories = teamRepos . map ( ( repo : Repository ) => {
61+ const repositories = ( teamRepos || [ ] ) . map ( ( repo : Repository ) => {
6462 return {
6563 title : repo . repository . name ,
6664 /**
@@ -72,7 +70,7 @@ const calculateSearchIndex = (dashboard: any, activeTeam: string) => {
7270 } ;
7371 } ) ;
7472
75- return new Fuse ( [ ...sandboxes , ...folders , ...( repositories || [ ] ) ] , {
73+ return new Fuse ( [ ...sandboxes , ...folders , ...repositories ] , {
7674 threshold : 0.1 ,
7775 distance : 1000 ,
7876 keys : [
@@ -122,7 +120,10 @@ export const useGetItems = ({
122120 const sandbox = item as SandboxFragmentDashboardFragment ;
123121
124122 // Remove draft sandboxes from other authors
125- return sandbox . draft && sandbox . author . username === username ;
123+ return (
124+ ! sandbox . draft ||
125+ ( sandbox . draft && sandbox . author . username === username )
126+ ) ;
126127 }
127128 ) ;
128129
0 commit comments