Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

make getNextPath ssr safe

Alaister Young39b58e99ec51
diff --git a/studio/lib/gotrue.ts b/studio/lib/gotrue.ts
index 97c7612be77..a06d1d936bb 100644
--- a/studio/lib/gotrue.ts
+++ b/studio/lib/gotrue.ts
@@ -41,6 +41,11 @@ export const getIdentity = (gotrueUser: User) => {
// NOTE: do not use any imports in this function,
// as it is use standalone in the documents head
export const getNextPath = () => {
+ if (typeof window === 'undefined') {
+ // make sure this method is SSR safe
+ return '/projects'
+ }
+
const searchParams = new URLSearchParams(location.search)
const returnTo = searchParams.get('next')