Skip to content

Commit 82c11c1

Browse files
authored
More cleanup (#3)
1 parent ebc87ce commit 82c11c1

File tree

161 files changed

+18
-1707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+18
-1707
lines changed

app/lib/http.server.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
import { redirect } from "react-router";
22
import redirectsFileContents from "../../_redirects?raw";
33

4-
export const CACHE_CONTROL = {
5-
/**
6-
* Keep it in the browser (and CDN) for 5 minutes so when they click
7-
* back/forward/etc. it's super fast. SWR for 1 week on CDN so it stays fast,
8-
* but people get typos/fixes and stuff too.
9-
*/
10-
DEFAULT: "max-age=300, stale-while-revalidate=604800",
11-
/**
12-
* Keep it in the browser (and CDN) for 1 day, we won't be updating these as
13-
* often until the conf is a bit closer, and we can prevent over-fetching from
14-
* Sessionize which is pretty slow.
15-
*/
16-
conf: `max-age=${60 * 60 * 24}, stale-while-revalidate=604800`,
17-
};
18-
194
// relative to where we're built, build/index.js
205
type Redirect = [string, string, number?];
216
let redirects: null | Redirect[] = null;
@@ -66,10 +51,6 @@ export function removeTrailingSlashes(request: Request) {
6651
}
6752
}
6853

69-
export function isProductionHost(request: Request) {
70-
return "remix.run" === request.headers.get("host");
71-
}
72-
7354
function getValidRedirectCode(code: string | number | undefined) {
7455
let defaultCode = 302;
7556
if (!code) return defaultCode;

app/root.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ import {
1818
} from "fathom-client";
1919
import "~/styles/tailwind.css";
2020
import "~/styles/bailwind.css";
21-
import {
22-
removeTrailingSlashes,
23-
isProductionHost,
24-
handleRedirects,
25-
} from "~/lib/http.server";
21+
import { removeTrailingSlashes, handleRedirects } from "~/lib/http.server";
2622
import { ColorSchemeScript, useColorScheme } from "~/lib/color-scheme";
2723
import iconsHref from "~/icons.svg";
2824
import cx from "clsx";
@@ -38,17 +34,14 @@ export const unstable_middleware: Route.unstable_MiddlewareFunction[] = [
3834

3935
export async function loader({ request }: LoaderFunctionArgs) {
4036
removeTrailingSlashes(request);
41-
let isDevHost = !isProductionHost(request);
4237
let url = new URL(request.url);
4338

4439
let siteUrl = "https://v2.remix.run";
4540

4641
return data({
4742
host: url.host,
4843
siteUrl,
49-
isProductionHost: !isDevHost,
5044
noIndex:
51-
isDevHost ||
5245
url.pathname === "/docs/en/v1/api/remix" ||
5346
url.pathname === "/docs/en/v1/api/conventions",
5447
});

app/routes/_extras.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
import type { HeadersFunction } from "react-router";
21
import { Outlet } from "react-router";
3-
import { CACHE_CONTROL } from "~/lib/http.server";
42
import { DocSearchModal } from "~/ui/docsearch";
53
import { Footer } from "~/ui/footer";
64
import { Header } from "~/ui/header";
75

8-
export const headers: HeadersFunction = () => {
9-
return {
10-
"Cache-Control": CACHE_CONTROL.DEFAULT,
11-
};
12-
};
13-
146
export default function ExtrasLayout() {
157
return (
168
<div className="flex h-full flex-1 flex-col">

app/routes/_marketing._index.tsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type HeadersFunction, data } from "react-router";
1+
import { data } from "react-router";
22
import { OutlineButtonLink, PrimaryButtonLink } from "~/ui/buttons";
33
import { getMarkdownTutPage, type Prose } from "~/lib/mdtut.server";
44
import "~/styles/index.css";
@@ -8,7 +8,6 @@ import { ScrollExperience } from "~/ui/homepage-scroll-experience";
88
import invariant from "tiny-invariant";
99
import { Fragment } from "react";
1010
import { getMeta } from "~/lib/meta";
11-
import { CACHE_CONTROL } from "~/lib/http.server";
1211
import type { Route } from "./+types/_marketing._index";
1312

1413
export function meta({ matches }: Route.MetaArgs) {
@@ -34,20 +33,12 @@ export const loader = async () => {
3433
invariant(mutations.type === "sequence", "mutations.md should be a sequence");
3534
invariant(errors.type === "sequence", "errors.md should be a sequence");
3635

37-
return data(
38-
{
39-
sample,
40-
sampleSm,
41-
mutations,
42-
errors,
43-
},
44-
{ headers: { "Cache-Control": CACHE_CONTROL.DEFAULT } },
45-
);
46-
};
47-
48-
export const headers: HeadersFunction = ({ loaderHeaders }) => {
49-
// Inherit the caching headers from the loader so we don't cache 404s
50-
return loaderHeaders;
36+
return data({
37+
sample,
38+
sampleSm,
39+
mutations,
40+
errors,
41+
});
5142
};
5243

5344
export default function Index({ loaderData }: Route.ComponentProps) {

app/routes/docs.$.tsx

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import {
88
data,
99
useLoaderData,
1010
} from "react-router";
11-
import type { HeadersFunction } from "react-router";
12-
import { CACHE_CONTROL } from "~/lib/http.server";
1311
import invariant from "tiny-invariant";
1412
import type { Doc } from "~/lib/docs";
1513
import { getDoc } from "~/lib/docs";
@@ -27,27 +25,17 @@ export async function loader({ params }: Route.LoaderArgs) {
2725
: `docs/${params["*"] || "index"}`;
2826
let doc = await getDoc(slug);
2927
if (!doc) throw null;
30-
return data(
31-
{ doc },
32-
{ headers: { "Cache-Control": CACHE_CONTROL.DEFAULT } },
33-
);
28+
return data({ doc });
3429
} catch (error) {
3530
console.error("Caught error in docs.$ loader", error);
3631
throw data(null, { status: 404 });
3732
}
3833
}
3934

40-
export const headers: HeadersFunction = ({ loaderHeaders }) => {
41-
// Inherit the caching headers from the loader so we don't cache 404s
42-
let headers = new Headers(loaderHeaders);
43-
headers.set("Vary", "Cookie");
44-
return headers;
45-
};
46-
4735
export function meta({ loaderData, matches }: Route.MetaArgs) {
4836
let rootData = matches[0].loaderData;
49-
invariant(rootData && "isProductionHost" in rootData, "No root data found");
50-
let { siteUrl, isProductionHost } = rootData;
37+
invariant(rootData, "No root data found");
38+
let { siteUrl } = rootData;
5139
let ogImageUrl = siteUrl + "/img/og.1.jpg";
5240

5341
if (!loaderData) {
@@ -56,9 +44,6 @@ export function meta({ loaderData, matches }: Route.MetaArgs) {
5644

5745
let { doc } = loaderData;
5846

59-
let robots = isProductionHost ? "index,follow" : "noindex,nofollow";
60-
robots = "index,follow";
61-
6247
return getMeta({
6348
title: `${doc.attrs.title} | Remix`,
6449
// TODO: add a description
@@ -70,8 +55,8 @@ export function meta({ loaderData, matches }: Route.MetaArgs) {
7055
{ name: "og:site_name", content: "Remix" },
7156
{ name: "docsearch:language", content: "en" },
7257
{ name: "docsearch:version", content: "main" },
73-
{ name: "robots", content: robots },
74-
{ name: "googlebot", content: robots },
58+
{ name: "robots", content: "index,follow" },
59+
{ name: "googlebot", content: "index,follow" },
7560
],
7661
});
7762
}

app/routes/docs.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
useNavigate,
1212
href,
1313
} from "react-router";
14-
import type { HeadersFunction } from "react-router";
1514
import cx from "clsx";
1615
import { DocSearch } from "~/ui/docsearch";
1716

@@ -25,17 +24,9 @@ import {
2524
setColorScheme,
2625
type ColorScheme,
2726
} from "~/lib/color-scheme";
28-
import { CACHE_CONTROL } from "~/lib/http.server";
2927
import { Doc, getMenu } from "~/lib/docs";
3028
import { useHydrated } from "~/ui/primitives/utils";
3129

32-
export const headers: HeadersFunction = () => {
33-
return {
34-
"Cache-Control": CACHE_CONTROL.DEFAULT,
35-
Vary: "Cookie",
36-
};
37-
};
38-
3930
export const loader = async () => {
4031
return {
4132
menu: await getMenu(),

data/authors.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

data/conf/.prettierrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

data/conf/2022/schedule.yaml

Lines changed: 0 additions & 89 deletions
This file was deleted.

0 commit comments

Comments
 (0)