Skip to content

Commit

Permalink
add force-dynamic to dynamic routes
Browse files Browse the repository at this point in the history
  • Loading branch information
dijonmusters committed Jul 20, 2023
1 parent 3e821ef commit 269c5c3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/with-supabase/app/_examples/protected-route/page.tsx
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

0 comments on commit 269c5c3

Please sign in to comment.