@@ -21,43 +21,42 @@ export const load: PageLoad = async ({ params, url, route, depends, parent }) =>
2121 const archivedPage = parseInt ( url . searchParams . get ( 'archivedPage' ) || '1' ) ;
2222 const archivedOffset = pageToOffset ( archivedPage , limit ) ;
2323
24- // fetch active projects with offset set
25- const activeProjects = await sdk . forConsole . projects . list ( {
26- queries : [
27- Query . offset ( offset ) ,
28- Query . equal ( 'teamId' , params . organization ) ,
29- Query . or ( [ Query . equal ( 'status' , 'active' ) , Query . isNull ( 'status' ) ] ) ,
30- Query . limit ( limit ) ,
31- Query . orderDesc ( '' )
32- ] ,
33- search : search || undefined
34- } ) ;
35-
36- // Fetch archived projects with separate pagination
37- const archivedProjects = await sdk . forConsole . projects . list ( {
38- queries : [
39- Query . offset ( archivedOffset ) ,
40- Query . equal ( 'teamId' , params . organization ) ,
41- Query . equal ( 'status' , 'archived' ) ,
42- Query . limit ( limit ) ,
43- Query . orderDesc ( '' )
44- ] ,
45- search : search || undefined
46- } ) ;
47-
48- // get total counts
49- const activeTotal = await sdk . forConsole . projects . list ( {
50- queries : [
51- Query . equal ( 'teamId' , params . organization ) ,
52- Query . or ( [ Query . equal ( 'status' , 'active' ) , Query . isNull ( 'status' ) ] )
53- ] ,
54- search : search || undefined
55- } ) ;
56-
57- const archivedTotal = await sdk . forConsole . projects . list ( {
58- queries : [ Query . equal ( 'teamId' , params . organization ) , Query . equal ( 'status' , 'archived' ) ] ,
59- search : search || undefined
60- } ) ;
24+ const [ activeProjects , archivedProjects , activeTotal , archivedTotal ] = await Promise . all ( [
25+ sdk . forConsole . projects . list ( {
26+ queries : [
27+ Query . offset ( offset ) ,
28+ Query . equal ( 'teamId' , params . organization ) ,
29+ Query . or ( [ Query . equal ( 'status' , 'active' ) , Query . isNull ( 'status' ) ] ) ,
30+ Query . limit ( limit ) ,
31+ Query . orderDesc ( '' )
32+ ] ,
33+ search : search || undefined
34+ } ) ,
35+ sdk . forConsole . projects . list ( {
36+ queries : [
37+ Query . offset ( archivedOffset ) ,
38+ Query . equal ( 'teamId' , params . organization ) ,
39+ Query . equal ( 'status' , 'archived' ) ,
40+ Query . limit ( limit ) ,
41+ Query . orderDesc ( '' )
42+ ] ,
43+ search : search || undefined
44+ } ) ,
45+ sdk . forConsole . projects . list ( {
46+ queries : [
47+ Query . equal ( 'teamId' , params . organization ) ,
48+ Query . or ( [ Query . equal ( 'status' , 'active' ) , Query . isNull ( 'status' ) ] )
49+ ] ,
50+ search : search || undefined
51+ } ) ,
52+ sdk . forConsole . projects . list ( {
53+ queries : [
54+ Query . equal ( 'teamId' , params . organization ) ,
55+ Query . equal ( 'status' , 'archived' )
56+ ] ,
57+ search : search || undefined
58+ } )
59+ ] ) ;
6160
6261 // set `default` if no region!
6362 for ( const project of activeProjects . projects ) {
0 commit comments