Skip to content

Commit 9cda3ae

Browse files
authored
📦 NEW: Remix 2.4.0 support (#15)
1 parent a23202e commit 9cda3ae

22 files changed

+76
-8721
lines changed

.eslintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
],
3737
//import
3838
"import/no-cycle": "error",
39-
"import/no-unresolved": "error",
4039
"import/no-default-export": "warn",
4140
"import/order": [
4241
"error",

app/entry.client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from "react";
22

33
import { RemixBrowser } from "@remix-run/react";
44
import { hydrateRoot } from "react-dom/client";
5-
import type { Locales } from "remix-utils";
5+
import type { Locales } from "remix-utils/locales/server";
66

77
import { LocaleProvider } from "~/utils";
88

app/entry.server.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { PassThrough } from "stream";
22

3-
import { Response } from "@remix-run/node";
4-
import type { EntryContext } from "@remix-run/node";
3+
import {
4+
createReadableStreamFromReadable,
5+
type EntryContext,
6+
} from "@remix-run/node";
57
import { RemixServer } from "@remix-run/react";
68
import isbot from "isbot";
79
import { renderToPipeableStream } from "react-dom/server";
8-
import { getClientLocales } from "remix-utils";
10+
import { getClientLocales } from "remix-utils/locales/server";
911

1012
import { LocaleProvider, getCookie, Logger } from "~/utils";
1113

@@ -34,11 +36,12 @@ export default function handleRequest(
3436
{
3537
[callbackName]() {
3638
const body = new PassThrough();
39+
const stream = createReadableStreamFromReadable(body);
3740

3841
responseHeaders.set("Content-Type", "text/html");
3942

4043
resolve(
41-
new Response(body, {
44+
new Response(stream, {
4245
status: didError ? 500 : responseStatusCode,
4346
headers: responseHeaders,
4447
}),

app/root.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import { Fragment, useEffect, useState } from "react";
22

33
import { Dialog, Transition } from "@headlessui/react";
44
import { Bars3Icon, XCircleIcon, XMarkIcon } from "@heroicons/react/24/outline";
5-
import { cssBundleHref } from "@remix-run/css-bundle";
65
import type {
76
LinksFunction,
8-
LoaderArgs,
9-
V2_MetaFunction as MetaFunction,
7+
LoaderFunctionArgs,
8+
MetaFunction,
109
} from "@remix-run/node";
1110
import {
1211
Form,
@@ -31,22 +30,16 @@ import { getUserTier } from "./modules/user";
3130
import tailwindStylesheetUrl from "./styles/tailwind.css";
3231

3332
export const links: LinksFunction = () => [
34-
{ rel: "preload", href: tailwindStylesheetUrl, as: "style" },
35-
{ rel: "stylesheet", href: tailwindStylesheetUrl, as: "style" },
36-
...(cssBundleHref
37-
? [
38-
{ rel: "preload", href: cssBundleHref, as: "style" },
39-
{ rel: "stylesheet", href: cssBundleHref },
40-
]
41-
: []),
33+
{ rel: "stylesheet preload prefetch", href: tailwindStylesheetUrl, as: "style" },
34+
4235
];
4336

4437
export const meta: MetaFunction = () => [
4538
{ title: "Notee" },
4639
{ name: "description", content: "Notee App" },
4740
];
4841

49-
export async function loader({ request }: LoaderArgs) {
42+
export async function loader({ request }: LoaderFunctionArgs) {
5043
const isAnonymous = await isAnonymousSession(request);
5144

5245
if (isAnonymous) {

app/routes/_index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type { LoaderArgs } from "@remix-run/node";
1+
import type { LoaderFunctionArgs } from "@remix-run/node";
22
import { useLoaderData } from "@remix-run/react";
33

44
import { ButtonLink } from "~/components";
55
import { isAnonymousSession } from "~/modules/auth";
66
import { getPricingPlan, PricingTable } from "~/modules/price";
77
import { getDefaultCurrency, response } from "~/utils";
88

9-
export async function loader({ request }: LoaderArgs) {
9+
export async function loader({ request }: LoaderFunctionArgs) {
1010
const isAnonymous = await isAnonymousSession(request);
1111

1212
if (!isAnonymous) {

app/routes/api.customer-portal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { ActionArgs } from "@remix-run/node";
1+
import type { ActionFunctionArgs } from "@remix-run/node";
22

33
import { requireAuthSession } from "~/modules/auth";
44
import { createBillingPortalSession } from "~/modules/billing-portal";
55
import { getBillingInfo } from "~/modules/user";
66
import { response } from "~/utils";
77

8-
export async function action({ request }: ActionArgs) {
8+
export async function action({ request }: ActionFunctionArgs) {
99
const authSession = await requireAuthSession(request);
1010
const { userId } = authSession;
1111

app/routes/api.subscribe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ActionArgs } from "@remix-run/node";
1+
import type { ActionFunctionArgs } from "@remix-run/node";
22
import { parseFormAny } from "react-zorm";
33
import { z } from "zod";
44

@@ -10,7 +10,7 @@ import { response, parseData, SupaStripeStackError } from "~/utils";
1010

1111
export type SubscribeApiAction = typeof action;
1212

13-
export async function action({ request }: ActionArgs) {
13+
export async function action({ request }: ActionFunctionArgs) {
1414
const authSession = await requireAuthSession(request);
1515
const { userId } = authSession;
1616

app/routes/api.webhook.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ActionArgs } from "@remix-run/node";
1+
import type { ActionFunctionArgs } from "@remix-run/node";
22
import { z } from "zod";
33

44
import { stripe } from "~/integrations/stripe";
@@ -52,7 +52,7 @@ async function getStripeEvent(request: Request) {
5252
}
5353
}
5454

55-
export async function action({ request }: ActionArgs) {
55+
export async function action({ request }: ActionFunctionArgs) {
5656
const event = await getStripeEvent(request);
5757
const eventId = event.id;
5858

app/routes/app.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CloudArrowUpIcon, TrashIcon } from "@heroicons/react/24/outline";
2-
import type { ActionArgs, LoaderArgs } from "@remix-run/node";
2+
import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
33
import {
44
Form,
55
useActionData,
@@ -27,7 +27,7 @@ import {
2727
*
2828
*/
2929

30-
export async function loader({ request }: LoaderArgs) {
30+
export async function loader({ request }: LoaderFunctionArgs) {
3131
const authSession = await requireAuthSession(request);
3232
const { userId } = authSession;
3333

@@ -56,7 +56,7 @@ const NoteFormSchema = z.object({
5656
content: z.string().trim().min(1),
5757
});
5858

59-
export async function action({ request }: ActionArgs) {
59+
export async function action({ request }: ActionFunctionArgs) {
6060
const authSession = await requireAuthSession(request);
6161
const { userId } = authSession;
6262

app/routes/checkout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { SparklesIcon } from "@heroicons/react/24/outline";
2-
import type { LoaderArgs } from "@remix-run/node";
2+
import type { LoaderFunctionArgs } from "@remix-run/node";
33
import { Link, useLoaderData, useSubmit } from "@remix-run/react";
44

55
import { useInterval } from "~/hooks";
66
import { requireAuthSession } from "~/modules/auth";
77
import { getSubscription } from "~/modules/subscription";
88
import { response } from "~/utils";
99

10-
export async function loader({ request }: LoaderArgs) {
10+
export async function loader({ request }: LoaderFunctionArgs) {
1111
const authSession = await requireAuthSession(request);
1212
const { userId } = authSession;
1313

0 commit comments

Comments
 (0)