Skip to content

Commit f48ec0b

Browse files
committed
Refactor: update CACHE_CONTROL import paths and clean up http.server.ts
- Remove deprecated CACHE_CONTROL export from http.server.ts to streamline imports. - Update import statements in marketing and jam layout files to use the new shared/cache-control path.
1 parent 071390a commit f48ec0b

File tree

4 files changed

+4
-9
lines changed

4 files changed

+4
-9
lines changed

app/lib/http.server.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ import { ArrayMatcher, RoutePattern } from "remix/route-pattern";
22
import { redirect } from "react-router";
33
import redirectsFileContents from "../../_redirects?raw";
44

5-
// Re-export from the standalone module so existing consumers aren't affected.
6-
// Remix 3 routes should import directly from ~/lib/cache-control to avoid
7-
// pulling in react-router (and its global JSX types) transitively.
8-
export { CACHE_CONTROL } from "./cache-control";
9-
105
export function requirePost(request: Request) {
116
if (request.method.toLowerCase() !== "post") {
127
throw new Response("", {
@@ -45,7 +40,6 @@ export function handleRedirects(pathname: string) {
4540
const { toPattern, status } = match.data;
4641
const params = match.params as Record<string, string | undefined>;
4742

48-
// Use RoutePattern.href() to build the redirect URL from matched params
4943
const redirectUrl = toPattern.href(params);
5044

5145
throw redirect(redirectUrl, { status });

app/routes/jam/pages/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Outlet, redirect, useMatches } from "react-router";
2-
import { CACHE_CONTROL } from "~/lib/http.server";
2+
33
import { Link } from "react-router";
44
import { useId, useRef } from "react";
55
import { clsx } from "clsx";
@@ -12,6 +12,7 @@ import type { Route } from "./+types/layout";
1212
import jamStyles from "../jam.css?url";
1313
import maskSrc from "../images/background-mask.avif";
1414
import seatsSrc from "../images/remix-color-seats.svg";
15+
import { CACHE_CONTROL } from "shared/cache-control";
1516

1617
export function headers() {
1718
return {

app/routes/marketing/home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
StayInTheLoopSection,
1010
TimelineSection,
1111
} from "~/ui/marketing/home";
12-
import { CACHE_CONTROL } from "~/lib/http.server";
12+
import { CACHE_CONTROL } from "shared/cache-control";
1313
import type { Route } from "./+types/home";
1414
import type { HeadersFunction } from "react-router";
1515

app/routes/marketing/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Outlet, type HeadersFunction } from "react-router";
22
import { DocSearchModal } from "~/ui/docsearch";
33
import { Header } from "~/ui/header";
44
import { Footer } from "~/ui/footer";
5-
import { CACHE_CONTROL } from "~/lib/http.server";
5+
import { CACHE_CONTROL } from "shared/cache-control";
66

77
export const headers: HeadersFunction = () => {
88
return {

0 commit comments

Comments
 (0)