Stream drivers, races and substitutes as promises for data/season page

This commit is contained in:
2024-12-16 04:03:37 +01:00
parent 5767603e87
commit 2bd3aa0417
2 changed files with 89 additions and 66 deletions

View File

@ -1,4 +1,4 @@
import type { Actions, PageServerLoad } from "./$types";
import type { ActionData, Actions, PageServerLoad } from "./$types";
import {
form_data_clean,
form_data_ensure_keys,
@ -286,10 +286,13 @@ export const load: PageServerLoad = async ({ fetch, locals }) => {
};
return {
// Graphics and teams are awaited, since those are visible on page load.
graphics: await fetch_graphics(),
teams: await fetch_teams(),
drivers: await fetch_drivers(),
races: await fetch_races(),
substitutions: await fetch_substitutions(),
// The rest is streamed gradually, since the user has to switch tabs to need them.
drivers: fetch_drivers(),
races: fetch_races(),
substitutions: fetch_substitutions(),
};
};