Skip to content

Commit 06f4c52

Browse files
authored
Merge pull request #284 from HerrBertling/revert-278-feat/274-better-caching
Revert "Feat: better caching"
2 parents 25829d6 + de4388e commit 06f4c52

19 files changed

+2064
-1342
lines changed

app/components/CleverLink.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Link } from "@remix-run/react";
22
import { type LinkProps } from "@remix-run/react";
33
import type { ReactNode } from "react";
4-
import cx from 'classnames';
54

65
interface CleverLinkProps extends LinkProps {
76
to: string;
@@ -33,7 +32,7 @@ export default function CleverLink({
3332
const usedLink = to.replace("https://www.virtualsupporttalks.de", "");
3433
return (
3534
<Link
36-
className={cx("text-vsp-500 hover:text-vsp-700 underline", className)}
35+
className={`text-vsp-500 hover:text-vsp-700 underline ${className}`}
3736
to={usedLink}
3837
prefetch={prefetch}
3938
>
@@ -45,7 +44,7 @@ export default function CleverLink({
4544
<a
4645
href={to}
4746
target="_blank"
48-
className={cx("text-vsp-500 hover:text-vsp-700 underline", className)}
47+
className={`text-vsp-500 hover:text-vsp-700 underline ${className}`}
4948
rel="noopener noreferrer"
5049
>
5150
{children}

app/components/ContentBlocks/ImageBg.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function ContentBlockImageBg({
1717
children,
1818
}: ContentBlockImageBgProps) {
1919
const hasButton = buttonUrl && buttonText;
20-
const usedBackgroundImage = `${backgroundImage?.fields?.file?.url}`;
20+
const usedBackgroundImage = backgroundImage?.fields?.file?.url;
2121
const backgroundStyle = usedBackgroundImage
2222
? { backgroundImage: `url(${usedBackgroundImage}?fm=avif&q=20)` }
2323
: {};

app/routes/$locale.$slug.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { HeadersFunction, LoaderFunction, MetaFunction } from "@remix-run/node";
1+
import type { LoaderFunction, MetaFunction } from "@remix-run/node";
22
import { useLoaderData } from "@remix-run/react";
33
import BasicCatchBoundary from "~/components/BasicErrorBoundary";
44
import ContentBlocks from "~/components/ContentBlocks";
@@ -31,13 +31,6 @@ export const meta: MetaFunction = ({ data }) => {
3131
];
3232
};
3333

34-
export const headers: HeadersFunction = () => ({
35-
// Tell the browser to always check the freshness of the cache
36-
"Cache-Control": "public, max-age=0, must-revalidate",
37-
// Tell the CDN to treat it as fresh for 5 minutes, but for a day after that return a stale version while it revalidates
38-
"Netlify-CDN-Cache-Control": "public, durable, s-maxage=300, stale-while-revalidate=86400",
39-
});
40-
4134
export const loader: LoaderFunction = async ({ params }) => {
4235
const { slug, locale } = params;
4336
const page = await getPage(slug, locale as LOCALE_CODE);

app/routes/$locale._index.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {
33
IPage,
44
LOCALE_CODE,
55
} from "../../@types/generated/contentful";
6-
import type { HeadersFunction, LoaderFunction, MetaFunction } from "@remix-run/node";
6+
import type { LoaderFunction, MetaFunction } from "@remix-run/node";
77
import { useLoaderData } from "@remix-run/react";
88
import { getLatestBlogposts, getPageById } from "~/utils/contentful";
99
import pageIds from "~/utils/pageIds";
@@ -31,13 +31,6 @@ export const meta: MetaFunction = ({ data }) => {
3131
];
3232
};
3333

34-
export const headers: HeadersFunction = () => ({
35-
// Tell the browser to always check the freshness of the cache
36-
"Cache-Control": "public, max-age=0, must-revalidate",
37-
// Tell the CDN to treat it as fresh for 5 minutes, but for a day after that return a stale version while it revalidates
38-
"Netlify-CDN-Cache-Control": "public, durable, s-maxage=300, stale-while-revalidate=86400",
39-
});
40-
4134
export const loader: LoaderFunction = async ({
4235
params,
4336
}): Promise<PageProps> => {

app/routes/$locale.blog.$post.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { HeadersFunction, LoaderFunction, MetaFunction } from "@remix-run/node";
1+
import type { LoaderFunction, MetaFunction } from "@remix-run/node";
22
import { useLoaderData } from "@remix-run/react";
33
import BasicCatchBoundary from "~/components/BasicErrorBoundary";
44
import ContentBlocks from "~/components/ContentBlocks";
@@ -30,13 +30,6 @@ export const meta: MetaFunction = ({
3030
];
3131
};
3232

33-
export const headers: HeadersFunction = () => ({
34-
// Tell the browser to always check the freshness of the cache
35-
"Cache-Control": "public, max-age=0, must-revalidate",
36-
// Tell the CDN to treat it as fresh for 5 minutes, but for a day after that return a stale version while it revalidates
37-
"Netlify-CDN-Cache-Control": "public, durable, s-maxage=300, stale-while-revalidate=86400",
38-
});
39-
4033
export const loader: LoaderFunction = async ({ params }) => {
4134
const { post, locale } = params;
4235

app/routes/$locale.blog._index.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
import type { HeadersFunction, LoaderFunction } from "@remix-run/node";
1+
import type { LoaderFunction } from "@remix-run/node";
22
import { useLoaderData } from "@remix-run/react";
33
import { useTranslation } from "react-i18next";
44
import BasicCatchBoundary from "~/components/BasicErrorBoundary";
55
import BlogpostCard from "~/components/BlogpostCard";
66
import { getBlogposts } from "~/utils/contentful";
77
import type { IBlogpost, LOCALE_CODE } from "../../@types/generated/contentful";
88

9-
export const headers: HeadersFunction = () => ({
10-
// Tell the browser to always check the freshness of the cache
11-
"Cache-Control": "public, max-age=0, must-revalidate",
12-
// Tell the CDN to treat it as fresh for 5 minutes, but for a day after that return a stale version while it revalidates
13-
"Netlify-CDN-Cache-Control": "public, durable, s-maxage=300, stale-while-revalidate=86400",
14-
});
15-
169
export const loader: LoaderFunction = async ({ params }) => {
1710
const locale = (params.locale as string) || "de";
1811
const posts = await getBlogposts(locale as LOCALE_CODE);

app/routes/$locale.blog.tag.$tag.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { HeadersFunction, LoaderFunction } from "@remix-run/node";
1+
import type { LoaderFunction } from "@remix-run/node";
22
import { useLoaderData } from "@remix-run/react";
33
import { useTranslation } from "react-i18next";
44
import BasicCatchBoundary from "~/components/BasicErrorBoundary";
@@ -10,13 +10,6 @@ import type {
1010
LOCALE_CODE,
1111
} from "../../@types/generated/contentful";
1212

13-
export const headers: HeadersFunction = () => ({
14-
// Tell the browser to always check the freshness of the cache
15-
"Cache-Control": "public, max-age=0, must-revalidate",
16-
// Tell the CDN to treat it as fresh for 5 minutes, but for a day after that return a stale version while it revalidates
17-
"Netlify-CDN-Cache-Control": "public, durable, s-maxage=300, stale-while-revalidate=86400",
18-
});
19-
2013
export const loader: LoaderFunction = async ({ params }) => {
2114
const tag = params.tag;
2215
const locale = (params.locale as string) || "de";

app/routes/de.ich-suche-redezeit.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
import type { HeadersFunction, LoaderFunction, MetaFunction } from "@remix-run/node";
1+
import type { LoaderFunction, MetaFunction } from "@remix-run/node";
22
import { useLoaderData } from "@remix-run/react";
33
import BasicCatchBoundary from "~/components/BasicErrorBoundary";
44
import BasicLayout from "~/components/layout/BasicLayout";
55
import SpeakingTimeContent from "~/components/SpeakingTimeContent";
66
import { getSeoMeta } from "~/seo";
77
import { getSearchPageContents } from "~/utils/getSearchPageContents";
88

9-
export const headers: HeadersFunction = () => ({
10-
// Tell the browser to always check the freshness of the cache
11-
"Cache-Control": "public, max-age=0, must-revalidate",
12-
// Tell the CDN to treat it as fresh for 5 minutes, but for a day after that return a stale version while it revalidates
13-
"Netlify-CDN-Cache-Control": "public, durable, s-maxage=300, stale-while-revalidate=86400",
14-
});
15-
169
export const loader: LoaderFunction = async ({ request }) => {
17-
const searchParams = new URL(request.url).searchParams;
18-
const data = await getSearchPageContents({searchParams, locale: "de"});
10+
const data = await getSearchPageContents(request, "de");
1911
return data;
2012
};
2113

app/routes/de.netzwerk-partner-medien.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { HeadersFunction, LoaderFunction, MetaFunction } from "@remix-run/node";
1+
import type { LoaderFunction, MetaFunction } from "@remix-run/node";
22
import { useLoaderData } from "@remix-run/react";
33
import NetworkPartnerMediaContent from "~/components/NetworkPartnerMediaContent";
44
import { getSeoMeta } from "~/seo";
@@ -11,13 +11,6 @@ import {
1111
} from "~/utils/contentful";
1212
import pageIds from "~/utils/pageIds";
1313

14-
export const headers: HeadersFunction = () => ({
15-
// Tell the browser to always check the freshness of the cache
16-
"Cache-Control": "public, max-age=0, must-revalidate",
17-
// Tell the CDN to treat it as fresh for 5 minutes, but for a day after that return a stale version while it revalidates
18-
"Netlify-CDN-Cache-Control": "public, durable, s-maxage=300, stale-while-revalidate=86400",
19-
});
20-
2114
export const meta: MetaFunction = ({ data }) => {
2215
const { title, seo } = data?.page?.fields;
2316

app/routes/en.i-need-speaking-time.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
import type { HeadersFunction, LoaderFunction, MetaFunction } from "@remix-run/node";
1+
import type { LoaderFunction, MetaFunction } from "@remix-run/node";
22
import { useLoaderData } from "@remix-run/react";
33
import BasicCatchBoundary from "~/components/BasicErrorBoundary";
44
import BasicLayout from "~/components/layout/BasicLayout";
55
import SpeakingTimeContent from "~/components/SpeakingTimeContent";
66
import { getSeoMeta } from "~/seo";
77
import { getSearchPageContents } from "~/utils/getSearchPageContents";
88

9-
export const headers: HeadersFunction = () => ({
10-
// Tell the browser to always check the freshness of the cache
11-
"Cache-Control": "public, max-age=0, must-revalidate",
12-
// Tell the CDN to treat it as fresh for 5 minutes, but for a day after that return a stale version while it revalidates
13-
"Netlify-CDN-Cache-Control": "public, durable, s-maxage=300, stale-while-revalidate=86400",
14-
});
15-
169
export const loader: LoaderFunction = async ({ request }) => {
17-
const searchParams = new URL(request.url).searchParams;
18-
const data = await getSearchPageContents({searchParams, locale: "en"});
10+
const data = await getSearchPageContents(request, "en");
1911
return data;
2012
};
2113

0 commit comments

Comments
 (0)