Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

PR fixes

Sara Vieira3033f2a19f08
diff --git a/app/routes/auth/dev.tsx b/app/routes/auth/dev.tsx
index fe018768c4..8c2648b0e0 100644
--- a/app/routes/auth/dev.tsx
+++ b/app/routes/auth/dev.tsx
@@ -1,7 +1,7 @@
import { ActionFunction, redirect } from "@remix-run/node";
import config from "~/config";
import { authenticator } from "~/services/auth.server";
-import { AUTH_PROVIDERS } from "~/shared/session/useLoginErrors";
+import { AUTH_PROVIDERS } from "~/shared/session/useLoginErrorMessage";
export default function Dev() {
return null;
diff --git a/app/routes/auth/github.tsx b/app/routes/auth/github.tsx
index 3e55523502..5dc6f039f5 100644
--- a/app/routes/auth/github.tsx
+++ b/app/routes/auth/github.tsx
@@ -3,7 +3,7 @@ import config from "~/config";
import { authenticator } from "~/services/auth.server";
import { sentryException } from "~/shared/sentry";
import { ensureUserCookie } from "~/shared/session";
-import { AUTH_PROVIDERS } from "~/shared/session/useLoginErrors";
+import { AUTH_PROVIDERS } from "~/shared/session/useLoginErrorMessage";
export default function GH() {
return null;
diff --git a/app/routes/auth/github/callback.tsx b/app/routes/auth/github/callback.tsx
index 5d26e4d19c..f3643ac55f 100644
--- a/app/routes/auth/github/callback.tsx
+++ b/app/routes/auth/github/callback.tsx
@@ -2,7 +2,7 @@ import { LoaderFunction, redirect } from "@remix-run/node";
import config from "~/config";
import { authenticator } from "~/services/auth.server";
import { ensureUserCookie } from "~/shared/session";
-import { AUTH_PROVIDERS } from "~/shared/session/useLoginErrors";
+import { AUTH_PROVIDERS } from "~/shared/session/useLoginErrorMessage";
export const loader: LoaderFunction = async ({ request }) => {
const { userId } = await ensureUserCookie(request);
diff --git a/app/routes/auth/google.tsx b/app/routes/auth/google.tsx
index cbb6ceb6a8..7471cc0fdc 100644
--- a/app/routes/auth/google.tsx
+++ b/app/routes/auth/google.tsx
@@ -3,7 +3,7 @@ import config from "~/config";
import { authenticator } from "~/services/auth.server";
import { sentryException } from "~/shared/sentry";
import { ensureUserCookie } from "~/shared/session";
-import { AUTH_PROVIDERS } from "~/shared/session/useLoginErrors";
+import { AUTH_PROVIDERS } from "~/shared/session/useLoginErrorMessage";
export default function Google() {
return null;
diff --git a/app/routes/login/index.tsx b/app/routes/login/index.tsx
index d19b18386e..77d7e926a5 100644
--- a/app/routes/login/index.tsx
+++ b/app/routes/login/index.tsx
@@ -5,7 +5,7 @@ import config from "~/config";
import env from "~/env.server";
import { Login, links } from "~/auth/";
-import { useLoginErrors } from "~/shared/session/useLoginErrors";
+import { useLoginErrorMessage } from "~/shared/session/useLoginErrorMessage";
export { links };
@@ -19,7 +19,7 @@ export const loader: LoaderFunction = async ({ request }) => {
};
const LoginRoute = () => {
- const errorMessage = useLoginErrors();
+ const errorMessage = useLoginErrorMessage();
return <Login errorMessage={errorMessage} />;
};
diff --git a/app/services/auth.server.ts b/app/services/auth.server.ts
index 28a6e4a572..8246a8e424 100644
--- a/app/services/auth.server.ts
+++ b/app/services/auth.server.ts
@@ -11,7 +11,7 @@ import {
createOrLoginWithGoogle,
} from "~/shared/db/user.server";
import { sentryException } from "~/shared/sentry";
-import { AUTH_PROVIDERS } from "~/shared/session/useLoginErrors";
+import { AUTH_PROVIDERS } from "~/shared/session/useLoginErrorMessage";
const url = `${
process.env.VERCEL_URL
diff --git a/app/shared/session/useLoginErrors.ts b/app/shared/session/useLoginErrorMessage.ts
similarity index 87%
rename from app/shared/session/useLoginErrors.ts
rename to app/shared/session/useLoginErrorMessage.ts
index 4539561219..7a12a8265f 100644
--- a/app/shared/session/useLoginErrors.ts
+++ b/app/shared/session/useLoginErrorMessage.ts
@@ -16,13 +16,14 @@ export const LOGIN_ERROR_MESSAGES = {
"There has been an issue logging you in with Google",
};
-export const useLoginErrors = (): string => {
+export const useLoginErrorMessage = (): string => {
const [searchParams, setSearchParams] = useSearchParams();
const [messageToReturn, setMessageToReturn] = useState("");
- const error = searchParams.get("error");
- const message = searchParams.get("message");
useEffect(() => {
+ const error = searchParams.get("error");
+ const message = searchParams.get("message");
+
const hasMessageToShow =
error !== null && Boolean(message) && typeof message === "string";
if (hasMessageToShow) {
@@ -51,7 +52,7 @@ export const useLoginErrors = (): string => {
}
setSearchParams({});
- }, [error, message, messageToReturn, searchParams, setSearchParams]);
+ }, [messageToReturn, searchParams, setSearchParams]);
return messageToReturn;
};