Skeleton: Define dependencies when fetching data
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
import { fetch_drivers, fetch_raceresults, fetch_races } from "$lib/fetch";
|
||||
import type { PageLoad } from "../../$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
export const load: PageLoad = async ({ fetch, depends }) => {
|
||||
depends("data:drivers", "data:races", "data:raceresults");
|
||||
|
||||
return {
|
||||
drivers: fetch_drivers(fetch),
|
||||
races: fetch_races(fetch),
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import { fetch_drivers, fetch_teams } from "$lib/fetch";
|
||||
import type { PageLoad } from "../../../$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
export const load: PageLoad = async ({ fetch, depends }) => {
|
||||
depends("data:teams", "data:drivers");
|
||||
|
||||
return {
|
||||
teams: fetch_teams(fetch),
|
||||
drivers: fetch_drivers(fetch),
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import { fetch_races } from "$lib/fetch";
|
||||
import type { PageLoad } from "../../../$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
export const load: PageLoad = async ({ fetch, depends }) => {
|
||||
depends("data:races");
|
||||
|
||||
return {
|
||||
races: fetch_races(fetch),
|
||||
};
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import { fetch_drivers, fetch_races, fetch_substitutions } from "$lib/fetch";
|
||||
import type { PageLoad } from "../../../$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
export const load: PageLoad = async ({ fetch, depends }) => {
|
||||
depends("data:races", "data:drivers", "data:substitutions");
|
||||
|
||||
return {
|
||||
races: fetch_races(fetch),
|
||||
drivers: fetch_drivers(fetch),
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import { fetch_teams } from "$lib/fetch";
|
||||
import type { PageLoad } from "../../../$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
export const load: PageLoad = async ({ fetch, depends }) => {
|
||||
depends("data:teams");
|
||||
|
||||
return {
|
||||
teams: fetch_teams(fetch),
|
||||
};
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import { fetch_users } from "$lib/fetch";
|
||||
import type { PageLoad } from "../../$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
export const load: PageLoad = async ({ fetch, depends }) => {
|
||||
depends("data:users");
|
||||
|
||||
return {
|
||||
users: await fetch_users(fetch),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user