Skip to content

Commit 276fb7b

Browse files

Some content is hidden

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

45 files changed

+278
-140
lines changed

apps/builder/app/root.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Our root outlet doesn't contain a layout because we have 2 types of documents: canvas and builder and we need to decide down the line which one to render, thre is no single root document.
2-
import { Outlet, json, useLoaderData } from "@remix-run/react";
2+
import { Outlet, useLoaderData } from "@remix-run/react";
33
import { setEnv } from "@webstudio-is/feature-flags";
44
import env from "./env/env.server";
55
import { useSetFeatures } from "./shared/use-set-features";
66

77
export const loader = () => {
8-
return json({
8+
return {
99
features: env.FEATURES,
10-
});
10+
};
1111
};
1212

1313
export default function App() {

apps/builder/app/routes/_ui.(builder).tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { lazy } from "react";
77
import { useLoaderData } from "@remix-run/react";
88
import type { MetaFunction, ShouldRevalidateFunction } from "@remix-run/react";
99
import {
10-
json,
10+
data,
1111
type HeadersArgs,
1212
type LoaderFunctionArgs,
1313
} from "@remix-run/server-runtime";
@@ -207,7 +207,7 @@ export const loader = async (loaderArgs: LoaderFunctionArgs) => {
207207
`frame-src ${url.origin}/canvas https://app.goentri.com/; worker-src 'none'`
208208
);
209209

210-
return json(
210+
return data(
211211
{
212212
project,
213213
publisherHost,

apps/builder/app/routes/_ui.dashboard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { lazy } from "react";
22
import { useLoaderData, type MetaFunction } from "@remix-run/react";
3-
import { json, type LoaderFunctionArgs } from "@remix-run/server-runtime";
3+
import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
44
import { dashboardProjectRouter } from "@webstudio-is/dashboard/index.server";
55
import { findAuthenticatedUser } from "~/services/auth.server";
66
import { builderUrl, isDashboard, loginPath } from "~/shared/router-utils";
@@ -112,7 +112,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
112112

113113
const { sourceOrigin } = parseBuilderUrl(request.url);
114114

115-
return json({
115+
return {
116116
user,
117117
projects,
118118
projectTemplates,
@@ -121,7 +121,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
121121
imageBaseUrl: env.IMAGE_BASE_URL,
122122
origin: sourceOrigin,
123123
projectToClone,
124-
});
124+
};
125125
};
126126

127127
/**

apps/builder/app/routes/_ui.login._index.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import {
22
type LinksFunction,
33
type LoaderFunctionArgs,
4-
type TypedResponse,
5-
json,
4+
data,
65
} from "@remix-run/server-runtime";
76
import { useLoaderData, type MetaFunction } from "@remix-run/react";
87
import { findAuthenticatedUser } from "~/services/auth.server";
@@ -49,9 +48,7 @@ export const meta: MetaFunction<typeof loader> = () => {
4948
return metas;
5049
};
5150

52-
export const loader = async ({
53-
request,
54-
}: LoaderFunctionArgs): Promise<TypedResponse<LoginProps>> => {
51+
export const loader = async ({ request }: LoaderFunctionArgs) => {
5552
if (false === isDashboard(request)) {
5653
throw new Response("Not Found", {
5754
status: 404,
@@ -83,14 +80,14 @@ export const loader = async ({
8380

8481
headers.append("Set-Cookie", await returnToCookie.serialize(returnTo));
8582

86-
return json(
83+
return data(
8784
{
8885
isSecretLoginEnabled: env.DEV_LOGIN === "true",
8986
isGithubEnabled: Boolean(env.GH_CLIENT_ID && env.GH_CLIENT_SECRET),
9087
isGoogleEnabled: Boolean(
9188
env.GOOGLE_CLIENT_ID && env.GOOGLE_CLIENT_SECRET
9289
),
93-
},
90+
} satisfies LoginProps,
9491
{ headers }
9592
);
9693
};

apps/builder/app/routes/_ui.logout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { json, type LoaderFunctionArgs } from "@remix-run/server-runtime";
1+
import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
22
import { createDebug } from "~/shared/debug";
33
import { builderUrl, isDashboard, loginPath } from "~/shared/router-utils";
44
import { preventCrossOriginCookie } from "~/services/no-cross-origin-cookie";
@@ -58,10 +58,10 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
5858
`${builderUrl({ projectId, origin: url.origin })}builder-logout`
5959
);
6060

61-
return json({
61+
return {
6262
redirectTo,
6363
logoutUrls,
64-
});
64+
};
6565
} catch (error) {
6666
if (error instanceof Response) {
6767
throw error;

apps/builder/app/routes/_ui.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import manropeVariableFont from "@fontsource-variable/manrope/index.css?url";
1111
import robotoMonoFont from "@fontsource/roboto-mono/index.css?url";
1212
import appCss from "../shared/app.css?url";
1313
import {
14-
json,
14+
data,
1515
type LinksFunction,
1616
type LoaderFunctionArgs,
1717
} from "@remix-run/server-runtime";
@@ -56,7 +56,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
5656
const [csrfToken, setCookieValue] = await getCsrfTokenAndCookie(request);
5757

5858
if (request.headers.get("sec-fetch-mode") !== "navigate") {
59-
return json({ csrfToken: "" });
59+
return { csrfToken: "" };
6060
}
6161

6262
const headers = new Headers();
@@ -65,7 +65,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
6565
headers.set("Set-Cookie", setCookieValue);
6666
}
6767

68-
return json(
68+
return data(
6969
{ csrfToken },
7070
{
7171
headers,

apps/builder/app/routes/builder-logout.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { json, type ActionFunctionArgs } from "@remix-run/server-runtime";
1+
import { data, type ActionFunctionArgs } from "@remix-run/server-runtime";
22
import { createDebug } from "~/shared/debug";
33
import { builderAuthenticator } from "~/services/builder-auth.server";
44
import { getAuthorizationServerOrigin } from "~/shared/router-utils/origins";
@@ -19,7 +19,7 @@ export const action = async ({ request }: ActionFunctionArgs) => {
1919
}
2020

2121
if (request.method !== "POST") {
22-
return json(
22+
return data(
2323
{ message: "Method not allowed" },
2424
{
2525
status: 405,

apps/builder/app/routes/dashboard-logout.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { json } from "@remix-run/server-runtime";
1+
import { data } from "@remix-run/server-runtime";
22
import { authenticator } from "~/services/auth.server";
33
import { isDashboard, loginPath } from "~/shared/router-utils";
44
import { preventCrossOriginCookie } from "~/services/no-cross-origin-cookie";
@@ -32,7 +32,7 @@ export const action = async ({ request }: ActionFunctionArgs) => {
3232

3333
headers.set("Content-Type", "application/json");
3434

35-
return json(
35+
return data(
3636
{
3737
redirectTo: error.headers.get("Location"),
3838
},

apps/builder/app/routes/n8n.$.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type LoaderFunctionArgs, json } from "@remix-run/server-runtime";
1+
import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
22
import { isRouteErrorResponse, useRouteError } from "@remix-run/react";
33
import { z } from "zod";
44
import { findAuthenticatedUser } from "~/services/auth.server";
@@ -119,7 +119,7 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
119119

120120
n8nResponse satisfies never;
121121

122-
return json({});
122+
return {};
123123
};
124124

125125
export const ErrorBoundary = () => {

apps/builder/app/routes/oauth.ws.authorize.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { json, type LoaderFunction } from "@remix-run/server-runtime";
1+
import { data, type LoaderFunction } from "@remix-run/server-runtime";
22
import { z } from "zod";
33
import { createDebug } from "~/shared/debug";
44
import { fromError } from "zod-validation-error";
@@ -103,7 +103,7 @@ export const loader: LoaderFunction = async ({ request }) => {
103103
if (false === parsedRedirect.success) {
104104
debug("redirect_uri not provided in query params");
105105

106-
return json(
106+
return data(
107107
{
108108
error: "invalid_request",
109109
error_description: "No redirect_uri provided",
@@ -126,7 +126,7 @@ export const loader: LoaderFunction = async ({ request }) => {
126126
) {
127127
debug("redirect_uri does not match the registered redirect URIs");
128128

129-
return json(
129+
return data(
130130
{
131131
error: "invalid_request",
132132
error_description:
@@ -196,7 +196,7 @@ export const loader: LoaderFunction = async ({ request }) => {
196196
) {
197197
debug("redirect_uri does not match the registered redirect URIs");
198198

199-
return json(
199+
return data(
200200
{
201201
error: "invalid_request",
202202
error_description:
@@ -260,7 +260,7 @@ export const loader: LoaderFunction = async ({ request }) => {
260260
console.error("error", error);
261261
debug("error", error);
262262

263-
throw json(
263+
throw data(
264264
{
265265
error: "server_error",
266266
error_description:

0 commit comments

Comments
 (0)