From 1861e10d6d7c222a229e946510c0085b611c8b25 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 16 Apr 2026 08:50:34 -0400 Subject: [PATCH] fix: restore missing next/server imports + add force-dynamic to admin routes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A botched sed command stripped the first import line from every admin route file, breaking NextRequest/NextResponse references. Restored all imports and added export const dynamic = 'force-dynamic' to all admin GET handlers so Next.js 14 never serves a stale cached response after a save — this was the root cause of changes appearing not to save. Co-Authored-By: Claude Sonnet 4.6 --- estore/src/app/api/admin/categories-display/route.ts | 2 ++ estore/src/app/api/admin/categories/route.ts | 2 ++ estore/src/app/api/admin/delivery-rates/route.ts | 2 ++ estore/src/app/api/admin/hours/route.ts | 2 ++ estore/src/app/api/admin/items/route.ts | 2 ++ estore/src/app/api/admin/occasions/route.ts | 2 ++ 6 files changed, 12 insertions(+) diff --git a/estore/src/app/api/admin/categories-display/route.ts b/estore/src/app/api/admin/categories-display/route.ts index 07cde29..2ba6eff 100644 --- a/estore/src/app/api/admin/categories-display/route.ts +++ b/estore/src/app/api/admin/categories-display/route.ts @@ -2,6 +2,8 @@ import { NextRequest, NextResponse } from 'next/server' import { getCategoryDisplayConfig, saveCategoryDisplayConfig } from '@/lib/categories-display' import type { CategoryDisplayConfig } from '@/lib/categories-display' +export const dynamic = 'force-dynamic' + export function GET() { return NextResponse.json(getCategoryDisplayConfig()) } diff --git a/estore/src/app/api/admin/categories/route.ts b/estore/src/app/api/admin/categories/route.ts index 47b71b4..c5e279f 100644 --- a/estore/src/app/api/admin/categories/route.ts +++ b/estore/src/app/api/admin/categories/route.ts @@ -10,6 +10,8 @@ function getClient() { return new Client({ accessToken: token, environment: env }) } +export const dynamic = 'force-dynamic' + // List all Square catalog categories export async function GET() { const client = getClient() diff --git a/estore/src/app/api/admin/delivery-rates/route.ts b/estore/src/app/api/admin/delivery-rates/route.ts index 33b7b7f..4998c7a 100644 --- a/estore/src/app/api/admin/delivery-rates/route.ts +++ b/estore/src/app/api/admin/delivery-rates/route.ts @@ -2,6 +2,8 @@ import { NextResponse } from 'next/server' import { readDeliveryRates, writeDeliveryRates } from '@/lib/delivery-rates' import type { DeliveryRatesConfig } from '@/lib/delivery' +export const dynamic = 'force-dynamic' + export async function GET() { return NextResponse.json(readDeliveryRates()) } diff --git a/estore/src/app/api/admin/hours/route.ts b/estore/src/app/api/admin/hours/route.ts index 8b6bdb9..5592600 100644 --- a/estore/src/app/api/admin/hours/route.ts +++ b/estore/src/app/api/admin/hours/route.ts @@ -2,6 +2,8 @@ import { NextRequest, NextResponse } from 'next/server' import { getHoursConfig, saveHoursConfig } from '@/lib/hours' import type { HoursConfig } from '@/lib/hours' +export const dynamic = 'force-dynamic' + export async function GET() { return NextResponse.json(getHoursConfig()) } diff --git a/estore/src/app/api/admin/items/route.ts b/estore/src/app/api/admin/items/route.ts index e363695..453e012 100644 --- a/estore/src/app/api/admin/items/route.ts +++ b/estore/src/app/api/admin/items/route.ts @@ -2,6 +2,8 @@ import { NextResponse } from 'next/server' import { getCatalog } from '@/lib/catalog-cache' import { readOverrides } from '@/lib/overrides' +export const dynamic = 'force-dynamic' + export async function GET() { try { const [{ items, fetchedAt }, overrides] = await Promise.all([ diff --git a/estore/src/app/api/admin/occasions/route.ts b/estore/src/app/api/admin/occasions/route.ts index c997127..c411fdf 100644 --- a/estore/src/app/api/admin/occasions/route.ts +++ b/estore/src/app/api/admin/occasions/route.ts @@ -3,6 +3,8 @@ import { OCCASIONS, getOccasionWindow } from '@/lib/occasions' import type { OccasionsConfig, CustomOccasionDef } from '@/lib/occasions' import { getOccasionsConfig, saveOccasionsConfig } from '@/lib/occasions-store' +export const dynamic = 'force-dynamic' + export function GET() { const config = getOccasionsConfig() const year = new Date().getFullYear()