Skip to content

Commit

Permalink
latestIssues cache added
Browse files Browse the repository at this point in the history
  • Loading branch information
ipapandinas committed Oct 21, 2024
1 parent 038e342 commit da98a56
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion api/core/issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const ISSUES_PATH = "/issues";

export async function getIssues(
query: IssueQueryParams & PaginationQueryParams = DEFAULT_QUERY,
tag?: string,
): Promise<PaginatedCustomResponse<Issue>> {
let allLanguages: string[] = [];
if (query?.technologies?.length) {
Expand All @@ -24,7 +25,7 @@ export async function getIssues(
const url = prepareUrl(`${ISSUES_PATH}`, queryDto);
const res = await coreApiClient.get<PaginatedCustomResponseDto<IssueDto>>(
url,
{ noStoreCache: true },
tag ? { tag } : { noStoreCache: true },
);

return {
Expand Down
12 changes: 8 additions & 4 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@ import {
DEFAULT_PAGINATED_RESPONSE,
} from "@/data/fetch";
import EventBanner from "@/components/event-banner";
import tags from "@/utils/tags";

const EXPLORE_LABEL = "Explore Open Contributions";

export default async function Home() {
const issues = await IssuesApi.getIssues({
offset: 0,
limit: DEFAULT_HOMEPAGE_PAGE_SIZE,
}).catch((error) => {
const issues = await IssuesApi.getIssues(
{
offset: 0,
limit: DEFAULT_HOMEPAGE_PAGE_SIZE,
},
tags.latestIssues,
).catch((error) => {
console.error("Error fetching issues:", error);
return DEFAULT_PAGINATED_RESPONSE;
});
Expand Down
1 change: 1 addition & 0 deletions utils/tags.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const tags = {
languages: "languages",
latestIssues: "latest-issues",
allProjects: "all-projects",
projectOptions: "project-options",
projects(slug: string) {
Expand Down

0 comments on commit da98a56

Please sign in to comment.