Skip to content

Commit 602e6e6

Browse files
committed
Merge branch 'main'
2 parents f726d55 + c34d0c9 commit 602e6e6

7 files changed

+23
-19
lines changed

apps/frontend/app/lib/utilities.server.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { parseWithZod } from "@conform-to/zod";
22
import { $path } from "@ignisda/remix-routes";
33
import {
4-
json,
54
redirect,
65
unstable_composeUploadHandlers,
76
unstable_createMemoryUploadHandler,
@@ -141,9 +140,11 @@ export const processSubmission = <Schema extends ZodTypeAny>(
141140
): output<Schema> => {
142141
const submission = parseWithZod(formData, { schema });
143142
if (submission.status !== "success")
144-
throw json({ status: "idle", submission } as const);
143+
throw Response.json({ status: "idle", submission } as const);
145144
if (!submission.value)
146-
throw json({ status: "error", submission } as const, { status: 400 });
145+
throw Response.json({ status: "error", submission } as const, {
146+
status: 400,
147+
});
147148
return submission.value;
148149
};
149150

apps/frontend/app/root.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ import "@mantine/core/styles.css";
1212
import "@mantine/notifications/styles.css";
1313
import {
1414
type LinksFunction,
15-
type LoaderFunctionArgs,
1615
type MetaFunction,
17-
json,
16+
unstable_defineLoader,
1817
} from "@remix-run/node";
1918
import {
2019
Links,
@@ -92,17 +91,17 @@ export const links: LinksFunction = () => {
9291
];
9392
};
9493

95-
export const loader = async ({ request }: LoaderFunctionArgs) => {
94+
export const loader = unstable_defineLoader(async ({ request }) => {
9695
const { toast, headers: toastHeaders } = await getToast(request);
9796
const colorScheme = await colorSchemeCookie.parse(
9897
request.headers.get("cookie") || "",
9998
);
10099
const defaultColorScheme = colorScheme || "light";
101-
return json(
100+
return Response.json(
102101
{ toast, defaultColorScheme },
103102
{ headers: combineHeaders(toastHeaders) },
104103
);
105-
};
104+
});
106105

107106
const queryClient = new QueryClient();
108107

apps/frontend/app/routes/_dashboard._index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ import {
6060

6161
const cookieName = CurrentWorkoutKey;
6262

63-
const getTake = (prefs: UserPreferences, el: DashboardElementLot) => {
64-
const t = prefs.general.dashboard.find(
63+
const getTake = (preferences: UserPreferences, el: DashboardElementLot) => {
64+
const t = preferences.general.dashboard.find(
6565
(de) => de.section === el,
6666
)?.numElements;
6767
invariant(typeof t === "number", `No take found for ${el}`);

apps/frontend/app/routes/_dashboard.media.$action.$lot.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const metadataMapping = {
108108
[MediaLot.Movie]: [MediaSource.Tmdb],
109109
[MediaLot.Show]: [MediaSource.Tmdb],
110110
[MediaLot.VisualNovel]: [MediaSource.Vndb],
111-
} as const;
111+
};
112112

113113
export const loader = unstable_defineLoader(async ({ request, params }) => {
114114
const [

apps/frontend/app/routes/actions.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ export const action = unstable_defineAction(async ({ request, response }) => {
197197
response.headers.append("Location", redirectTo.toString());
198198
response.status = 302;
199199
}
200-
return returnData;
200+
// FIXME Once https://discord.com/channels/770287896669978684/1251219797098762290 is resolved
201+
return Response.json(returnData, {
202+
headers: response.headers,
203+
status: response.status,
204+
});
201205
});
202206

203207
const commitMediaSchema = z.object({

apps/frontend/app/routes/api.auth.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { $path } from "@ignisda/remix-routes";
2-
import { type LoaderFunctionArgs, redirect } from "@remix-run/node";
2+
import { redirect, unstable_defineLoader } from "@remix-run/node";
33
import {
44
CoreDetailsDocument,
55
GetOidcTokenDocument,
@@ -19,7 +19,7 @@ const searchParamsSchema = z.object({ code: z.string() });
1919

2020
export type SearchParams = z.infer<typeof searchParamsSchema>;
2121

22-
export const loader = async ({ request }: LoaderFunctionArgs) => {
22+
export const loader = unstable_defineLoader(async ({ request }) => {
2323
const input = zx.parseQuery(request, searchParamsSchema);
2424
const { getOidcToken } = await gqlClient.request(GetOidcTokenDocument, input);
2525
const oidcInput = {
@@ -43,5 +43,5 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
4343
),
4444
});
4545
}
46-
return Response.json({ input });
47-
};
46+
return { input };
47+
});

apps/frontend/app/routes/api.fitness.exercises.$id.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type { LoaderFunctionArgs } from "@remix-run/node";
1+
import { unstable_defineLoader } from "@remix-run/node";
22
import {
33
ExerciseDetailsDocument,
44
UserExerciseDetailsDocument,
55
} from "@ryot/generated/graphql/backend/graphql";
66
import invariant from "tiny-invariant";
77
import { getAuthorizationHeader, gqlClient } from "~/lib/utilities.server";
88

9-
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
9+
export const loader = unstable_defineLoader(async ({ request, params }) => {
1010
const exerciseId = params.id;
1111
invariant(exerciseId, "No exercise ID provided");
1212
const [{ exerciseDetails }, { userExerciseDetails }] = await Promise.all([
@@ -21,4 +21,4 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
2121
details: { images: exerciseDetails.attributes.images },
2222
history: userExerciseDetails.history,
2323
};
24-
};
24+
});

0 commit comments

Comments
 (0)