Skip to content

Commit

Permalink
Fix Events Page ISR (#83)
Browse files Browse the repository at this point in the history
* Update Dependencies

* Test With Revalidate Flag

* Remove Cache
  • Loading branch information
timoclsn authored Mar 26, 2024
1 parent cb2516c commit 7959d18
Show file tree
Hide file tree
Showing 4 changed files with 1,433 additions and 1,403 deletions.
11 changes: 0 additions & 11 deletions lib/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
Wrench,
} from "lucide-react";
import { z } from "zod";
import { getCacheValue, setCacheValue } from "./cache";
import { customField, getEvents } from "./easyverein";

const TIMEZONE = "Europe/Berlin";
Expand All @@ -36,14 +35,6 @@ const websiteEventSchema = z.object({
});

export const getWebsiteEvents = async (): Promise<WebsiteEvent[]> => {
const cachedData = await getCacheValue("events", z.array(websiteEventSchema));
if (cachedData) {
console.info("Events loaded from cache");
return cachedData;
}

console.info("Fetching events from API");

const events = await getEvents();

const websiteEvents = events
Expand All @@ -69,8 +60,6 @@ export const getWebsiteEvents = async (): Promise<WebsiteEvent[]> => {
})
.sort((a, b) => a.start.getTime() - b.start.getTime());

setCacheValue("events", websiteEvents);

return websiteEvents;
};

Expand Down
14 changes: 0 additions & 14 deletions lib/members.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import kebabCase from "lodash/kebabCase";
import trim from "lodash/trim";
import z from "zod";
import { getCacheValue, setCacheValue } from "./cache";
import { customField, getMembers } from "./easyverein";

const { NODE_ENV } = process.env;
Expand Down Expand Up @@ -51,17 +50,6 @@ const customFieldNames = {
} as const;

export const getWebsiteMembers = async (): Promise<WebsiteMember[]> => {
const cachedData = await getCacheValue(
"members",
z.array(websiteMemberSchema),
);
if (cachedData) {
console.info("Members loaded from cache");
return cachedData;
}

console.info("Fetching members from API");

const apiMembers = await getActiveMembers();

const websiteMembers = apiMembers
Expand Down Expand Up @@ -150,8 +138,6 @@ export const getWebsiteMembers = async (): Promise<WebsiteMember[]> => {
})
.sort((a, b) => a.familyName.localeCompare(b.familyName));

setCacheValue("members", websiteMembers);

return websiteMembers;
};

Expand Down
27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,30 @@
"date-fns": "2.30.0",
"date-fns-tz": "^2.0.0",
"lodash": "4.17.21",
"lucide-react": "^0.321.0",
"next": "14.1.0",
"lucide-react": "^0.363.0",
"next": "14.1.4",
"next-mdx-remote": "^4.4.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"sharp": "0.33.2",
"sharp": "0.33.3",
"zod": "^3.22.4"
},
"devDependencies": {
"@tailwindcss/typography": "0.5.10",
"@types/ical": "^0.8.3",
"@types/lodash": "4.14.202",
"@types/node": "20.11.16",
"@types/react": "18.2.52",
"autoprefixer": "10.4.17",
"eslint": "8.47.0",
"eslint-config-next": "14.1.0",
"@tailwindcss/typography": "0.5.11",
"@types/lodash": "4.17.0",
"@types/node": "20.11.30",
"@types/react": "18.2.72",
"autoprefixer": "10.4.19",
"eslint": "8.57.0",
"eslint-config-next": "14.1.4",
"eslint-config-prettier": "9.1.0",
"postcss": "8.4.33",
"postcss": "8.4.38",
"prettier": "3.2.5",
"prettier-plugin-tailwindcss": "0.5.11",
"prettier-plugin-tailwindcss": "0.5.12",
"reading-time": "1.5.0",
"schema-dts": "^1.1.2",
"tailwindcss": "3.4.1",
"tailwindcss-animate": "^1.0.7",
"typescript": "5.1.6"
"typescript": "5.4.3"
}
}
Loading

0 comments on commit 7959d18

Please sign in to comment.