Files
sexy/packages/frontend/src/routes/+page.server.ts
Valknar XXX 10ab7a65df fix: ensure home page data is serializable
Fixed serialization error by converting Directus SDK response objects to
plain JSON using JSON.parse(JSON.stringify()).

This resolves the error:
'Data returned from load while rendering / is not serializable:
Cannot stringify arbitrary non-POJOs (data.models)'

Also improved performance by using Promise.all to fetch models and videos
in parallel instead of sequentially.
2025-10-28 23:41:40 +01:00

14 lines
392 B
TypeScript

import { getFeaturedModels, getFeaturedVideos } from "$lib/services";
export async function load({ fetch }) {
const [models, videos] = await Promise.all([
getFeaturedModels(3, fetch),
getFeaturedVideos(3, fetch),
]);
// Ensure data is serializable by converting to plain JSON
return {
models: JSON.parse(JSON.stringify(models)),
videos: JSON.parse(JSON.stringify(videos)),
};
}