fixed cache not revalidating at all
continuous-integration/drone/push Build is passing Details

pull/2/head
Guus van Meerveld 2 months ago
parent a16fca25d9
commit 59a3056c0b

@ -19,6 +19,7 @@
"@nextui-org/react": "^2.2.10",
"@prisma/client": "4.10.1",
"@tanstack/react-query": "^4.24.9",
"autoprefixer": "^10.4.18",
"axios": "^1.1.2",
"bcrypt": "^5.1.0",
"framer-motion": "^11.0.8",
@ -26,22 +27,21 @@
"iron-session": "^6.3.1",
"next": "^14.1.1",
"next-themes": "^0.2.1",
"postcss": "^8.4.35",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^5.0.1",
"tailwindcss": "^3.4.1",
"timeago.js": "^4.0.2",
"zod": "^3.20.6",
"autoprefixer": "^10.4.18",
"postcss": "^8.4.35",
"tailwindcss": "^3.4.1"
"zod": "^3.20.6"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
"@types/bcrypt": "^5.0.0",
"@types/fs-extra": "^11.0.4",
"@types/node": "^15.12.1",
"@types/react": "^17.0.9",
"@types/react-dom": "^17.0.6",
"@types/react": "^18.2.64",
"@types/react-dom": "^18.2.21",
"eslint": "^7.28.0",
"eslint-config-next": "13.1.6",
"prettier": "^2.3.1",

@ -3,44 +3,46 @@ import path from "path";
import { avatarFileFormat } from "./constants";
import { cache } from "react";
import Landing, { LandingModel } from "@models/landing";
import exists from "@utils/fileExists";
export const readLandingJson = async (
dataDirLocation: string
): Promise<Landing> => {
const landingJsonLocation = path.join(dataDirLocation, "landing.json");
export const readLandingJson = cache(
async (dataDirLocation: string): Promise<Landing> => {
const landingJsonLocation = path.join(dataDirLocation, "landing.json");
const fileExists = await exists(landingJsonLocation);
const fileExists = await exists(landingJsonLocation);
if (!fileExists) {
throw new Error(
`Could not find landing json file at: ${landingJsonLocation}`
);
}
if (!fileExists) {
throw new Error(
`Could not find landing json file at: ${landingJsonLocation}`
);
}
const rawJson: unknown = await readJson(landingJsonLocation);
const rawJson: unknown = await readJson(landingJsonLocation);
const landingResult = LandingModel.safeParse(rawJson);
const landingResult = LandingModel.safeParse(rawJson);
if (!landingResult.success)
throw new Error(`Failed to parse landing json: ${landingResult.error}`);
if (!landingResult.success)
throw new Error(`Failed to parse landing json: ${landingResult.error}`);
return landingResult.data;
};
return landingResult.data;
}
);
export const readAvatarFile = async (
dataDirLocation: string
): Promise<string> => {
const avatarFileLocation = path.join(
dataDirLocation,
`avatar.${avatarFileFormat}`
);
export const readAvatarFile = cache(
async (dataDirLocation: string): Promise<string> => {
const avatarFileLocation = path.join(
dataDirLocation,
`avatar.${avatarFileFormat}`
);
const imageData = await readFile(avatarFileLocation);
const imageData = await readFile(avatarFileLocation);
const base64Image = Buffer.from(imageData).toString("base64");
const base64Image = Buffer.from(imageData).toString("base64");
return `data:image/${avatarFileFormat};base64,${base64Image}`;
};
return `data:image/${avatarFileFormat};base64,${base64Image}`;
}
);

@ -2279,17 +2279,17 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb"
integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==
"@types/react-dom@^17.0.6":
version "17.0.25"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.25.tgz#e0e5b3571e1069625b3a3da2b279379aa33a0cb5"
integrity sha512-urx7A7UxkZQmThYA4So0NelOVjx3V4rNFVJwp0WZlbIK5eM4rNJDiN3R/E9ix0MBh6kAEojk/9YL+Te6D9zHNA==
"@types/react-dom@^18.2.21":
version "18.2.21"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.21.tgz#b8c81715cebdebb2994378616a8d54ace54f043a"
integrity sha512-gnvBA/21SA4xxqNXEwNiVcP0xSGHh/gi1VhWv9Bl46a0ItbTT5nFY+G9VSQpaG/8N/qdJpJ+vftQ4zflTtnjLw==
dependencies:
"@types/react" "^17"
"@types/react" "*"
"@types/react@^17", "@types/react@^17.0.9":
version "17.0.75"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.75.tgz#cffbc76840a12fcadaf5a3cf14878bb06efcf73d"
integrity sha512-MSA+NzEzXnQKrqpO63CYqNstFjsESgvJAdAyyJ1n6ZQq/GLgf6nOfIKwk+Twuz0L1N6xPe+qz5xRCJrbhMaLsw==
"@types/react@*", "@types/react@^18.2.64":
version "18.2.64"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.64.tgz#3700fbb6b2fa60a6868ec1323ae4cbd446a2197d"
integrity sha512-MlmPvHgjj2p3vZaxbQgFUQFvD8QiZwACfGqEdDSWou5yISWxDQ4/74nCAwsUiX7UFLKZz3BbVSPj+YxeoGGCfg==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"

Loading…
Cancel
Save