@@ -50,7 +50,16 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
5050 } )
5151 const searchParams = new URL ( request . url ) . searchParams
5252 const cacheOptions = { request, timings }
53- const exerciseStepApp = await requireExerciseApp ( params , cacheOptions )
53+
54+ const [ exerciseStepApp , allAppsFull , problemApp , solutionApp ] =
55+ await Promise . all ( [
56+ requireExerciseApp ( params , cacheOptions ) ,
57+ getApps ( cacheOptions ) ,
58+ getExerciseApp ( { ...params , type : 'problem' } , cacheOptions ) ,
59+ getExerciseApp ( { ...params , type : 'solution' } , cacheOptions ) ,
60+ ] )
61+
62+ const playgroundApp = allAppsFull . find ( isPlaygroundApp )
5463 const reqUrl = new URL ( request . url )
5564
5665 const pathnameParam = reqUrl . searchParams . get ( 'pathname' )
@@ -59,22 +68,6 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
5968 throw redirect ( reqUrl . toString ( ) )
6069 }
6170
62- const problemApp = await getExerciseApp (
63- { ...params , type : 'problem' } ,
64- cacheOptions ,
65- )
66- const solutionApp = await getExerciseApp (
67- { ...params , type : 'solution' } ,
68- cacheOptions ,
69- )
70-
71- if ( ! problemApp && ! solutionApp ) {
72- throw new Response ( 'Not found' , { status : 404 } )
73- }
74-
75- const allAppsFull = await getApps ( cacheOptions )
76- const playgroundApp = allAppsFull . find ( isPlaygroundApp )
77-
7871 const app1Name = reqUrl . searchParams . get ( 'app1' )
7972 const app2Name = reqUrl . searchParams . get ( 'app2' )
8073 const app1 = app1Name
0 commit comments