Skip to content

Commit 91ff0d9

Browse files
authored
Optimize fetching projects (#98)
1 parent bff87de commit 91ff0d9

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/routes/+layout.server.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ export function load({ locals }) {
1414
}
1515

1616
async function getSemesters(contentWrapper: ContentWrapper) {
17-
const projects: Project[] = await contentWrapper.get("project");
17+
// const projects: Project[] = await contentWrapper.get("project");
18+
19+
// OPTIMIZATION: Only fetch the 'semester' field
20+
// We use 'select' to filter out images, descriptions, and other heavy data
21+
const projects: Project[] = await contentWrapper.get("project", {
22+
select: "fields.semester",
23+
});
1824

1925
const { semesters } = generateProjectsInfo(projects);
2026

0 commit comments

Comments
 (0)