Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples: export force-dynamic from all dynamic routes #52916

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -8,6 +8,8 @@ import { cookies } from 'next/headers'
import Image from 'next/image'
import { redirect } from 'next/navigation'

export const dynamic = 'force-dynamic'

export default async function ProtectedRoute() {
const supabase = createServerComponentClient({ cookies })

Expand Down
2 changes: 2 additions & 0 deletions examples/with-supabase/app/_examples/route-handler/route.ts
Expand Up @@ -4,6 +4,8 @@ import { createRouteHandlerClient } from '@supabase/auth-helpers-nextjs'
import { cookies } from 'next/headers'
import { NextResponse } from 'next/server'

export const dynamic = 'force-dynamic'

export async function GET() {
// Create a Supabase client configured to use cookies
const supabase = createRouteHandlerClient({ cookies })
Expand Down
2 changes: 2 additions & 0 deletions examples/with-supabase/app/_examples/server-action/page.tsx
Expand Up @@ -4,6 +4,8 @@ import { createServerActionClient } from '@supabase/auth-helpers-nextjs'
import { revalidatePath } from 'next/cache'
import { cookies } from 'next/headers'

export const dynamic = 'force-dynamic'

export default async function ServerAction() {
const addTodo = async (formData: FormData) => {
'use server'
Expand Down
Expand Up @@ -3,6 +3,8 @@
import { createServerComponentClient } from '@supabase/auth-helpers-nextjs'
import { cookies } from 'next/headers'

export const dynamic = 'force-dynamic'

export default async function ServerComponent() {
// Create a Supabase client configured to use cookies
const supabase = createServerComponentClient({ cookies })
Expand Down
2 changes: 2 additions & 0 deletions examples/with-supabase/app/auth/callback/route.ts
Expand Up @@ -2,6 +2,8 @@ import { createRouteHandlerClient } from '@supabase/auth-helpers-nextjs'
import { cookies } from 'next/headers'
import { NextResponse } from 'next/server'

export const dynamic = 'force-dynamic'

export async function GET(request: Request) {
// The `/auth/callback` route is required for the server-side auth flow implemented
// by the Auth Helpers package. It exchanges an auth code for the user's session.
Expand Down
2 changes: 2 additions & 0 deletions examples/with-supabase/app/page.tsx
Expand Up @@ -5,6 +5,8 @@ import LogoutButton from '../components/LogoutButton'
import SupabaseLogo from '../components/SupabaseLogo'
import NextJsLogo from '../components/NextJsLogo'

export const dynamic = 'force-dynamic'

const resources = [
{
title: 'Cookie-based Auth and the Next.js App Router',
Expand Down
3 changes: 2 additions & 1 deletion examples/with-supabase/package.json
Expand Up @@ -19,6 +19,7 @@
"devDependencies": {
"@types/node": "20.3.1",
"@types/react": "18.2.12",
"@types/react-dom": "18.2.5"
"@types/react-dom": "18.2.5",
"encoding": "^0.1.13"
}
}