Aggressively deprecate app.urls.xyz & update docs to avoid it

Closes #1587
This commit is contained in:
Konstantin Wohlwend
2026-06-17 09:56:41 -07:00
parent c50f1e64ed
commit ec0008d515
29 changed files with 180 additions and 81 deletions
File diff suppressed because one or more lines are too long
@@ -123,7 +123,6 @@ Let's create a sample table and some RLS policies to demonstrate how to integrat
import { createSupabaseClient } from "@/utils/supabase-client";
import { useHexclaveApp, useUser } from "@hexclave/next";
import Link from "next/link";
import { useEffect, useState } from "react";
export default function Page() {
@@ -149,9 +148,9 @@ Let's create a sample table and some RLS policies to demonstrate how to integrat
<>
<p>You are signed in</p>
<p>User ID: {user.id}</p>
<Link href={app.urls.signOut}>Sign Out</Link>
<button onClick={async () => await app.redirectToSignOut()}>Sign Out</button>
</> :
<Link href={app.urls.signIn}>Sign In</Link>
<button onClick={async () => await app.redirectToSignIn()}>Sign In</button>
}
<h3>Supabase data</h3>
<ul>{listContent}</ul>
@@ -114,12 +114,11 @@ After setup, open the hosted auth UI (for example `/handler/sign-up`), create a
### Marketing header: sign in / sign out
Use `useHexclaveApp()` so you do not hard-code handler URLs (they can be customized in the project):
Use `useHexclaveApp()` so navigation goes through Hexclave's redirect helpers:
```tsx title="components/auth-header.tsx"
"use client";
import Link from "next/link";
import { useHexclaveApp, useUser } from "@hexclave/next";
export function AuthHeader() {
@@ -131,13 +130,13 @@ export function AuthHeader() {
{user ? (
<>
<span>{user.displayName ?? user.primaryEmail ?? user.id}</span>
<Link href={app.urls.accountSettings}>Account</Link>
<Link href={app.urls.signOut}>Sign out</Link>
<button onClick={async () => await app.redirectToAccountSettings()}>Account</button>
<button onClick={async () => await app.redirectToSignOut()}>Sign out</button>
</>
) : (
<>
<Link href={app.urls.signIn}>Sign in</Link>
<Link href={app.urls.signUp}>Sign up</Link>
<button onClick={async () => await app.redirectToSignIn()}>Sign in</button>
<button onClick={async () => await app.redirectToSignUp()}>Sign up</button>
</>
)}
</header>
@@ -44,7 +44,7 @@ You typically combine **one or more** of:
Match **only** prefixes that should be gated. Do **not** blanket-match `/` or you can block static assets and Stacks **`/handler`** routes (sign-in, sign-up, callbacks).
If your project uses **custom handler base paths**, use the sign-in URL from `hexclaveServerApp.urls.signIn` as the redirect target instead of hard-coding `/handler/sign-in` (it may be an absolute URL depending on configuration—`NextResponse.redirect` accepts that).
If your project uses hosted components or cross-domain auth, prefer protecting pages with `hexclaveServerApp.getUser({ or: "redirect" })` in a Server Component. Middleware cannot run the runtime `redirectToSignIn()` helper, so only hard-code `/handler/sign-in` here when your app owns a same-domain handler route.
</Tab>
<Tab title="Server Component">
```tsx title="app/app/dashboard/page.tsx"
+2 -3
View File
@@ -731,7 +731,6 @@ Follow these instructions to integrate Hexclave with Convex.
import { createSupabaseClient } from "@/utils/supabase-client";
import { useHexclaveApp, useUser } from "@hexclave/next";
import Link from "next/link";
import { useEffect, useState } from "react";
export default function Page() {
@@ -756,10 +755,10 @@ Follow these instructions to integrate Hexclave with Convex.
<>
<p>You are signed in</p>
<p>User ID: {user.id}</p>
<Link href={app.urls.signOut}>Sign Out</Link>
<button onClick={async () => await app.redirectToSignOut()}>Sign Out</button>
</>
) : (
<Link href={app.urls.signIn}>Sign In</Link>
<button onClick={async () => await app.redirectToSignIn()}>Sign In</button>
)}
<h3>Supabase data</h3>
<ul>{listContent}</ul>
+1 -1
View File
@@ -15,7 +15,7 @@ import { useHexclaveApp } from "@hexclave/next"; // replace `next` with the cor
function MyComponent() {
const hexclaveApp = useHexclaveApp();
return <div>Sign In URL: {hexclaveApp.urls.signIn}</div>;
return <button onClick={async () => await hexclaveApp.redirectToSignIn()}>Sign in</button>;
}
```
File diff suppressed because one or more lines are too long