Skip to content

Commit

Permalink
fix: Remove hardcoded projects query from index
Browse files Browse the repository at this point in the history
  • Loading branch information
kiosion committed Nov 4, 2023
1 parent 8ed93a3 commit be8a2de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion svelte-app/src/lib/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const BASE_TRANSITION_DURATION = 200 as const;
export const BASE_ANIMATION_DURATION = 300 as const;

export const HOMEPAGE_POSTS_NUM = 4 as const;
export const HOMEPAGE_PROJECTS_NUM = 1 as const;
export const HOMEPAGE_PROJECTS_NUM = 4 as const;

export const RECENT_POSTS_COUNT = 99;
export const RECENT_PROJECTS_COUNT = 99;
Expand Down
12 changes: 6 additions & 6 deletions svelte-app/src/routes/[[lang=lang]]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DEFAULT_APP_LANG, HOMEPAGE_POSTS_NUM } from '$lib/consts';
import { DEFAULT_APP_LANG, HOMEPAGE_POSTS_NUM, HOMEPAGE_PROJECTS_NUM } from '$lib/consts';
import { handleLoadError } from '$lib/data';
import { find, findOne } from '$lib/store';
import { find } from '$lib/store';

import type { PageLoad } from './$types';
import type { AuthorDocument, PostDocument, ProjectDocument } from '$types';
Expand All @@ -10,14 +10,14 @@ export const load = (async ({ parent, fetch, params }) => {
promises = [
parent().then((data) => data.about),
find(fetch, 'post', { limit: HOMEPAGE_POSTS_NUM, lang }),
findOne(fetch, 'project', { id: 'kio.dev', lang })
find(fetch, 'project', { limit: HOMEPAGE_PROJECTS_NUM, lang })
];

const [about, posts, project] = handleLoadError(await Promise.all(promises)) as [
const [about, posts, projects] = handleLoadError(await Promise.all(promises)) as [
AuthorDocument,
PostDocument[],
ProjectDocument
ProjectDocument[]
];

return { posts, projects: [project], about };
return { posts, projects, about };
}) satisfies PageLoad;

0 comments on commit be8a2de

Please sign in to comment.