Refactor: move public storefront stop data to server-side + parallel agent work

Server-side / caching refactor (Grok):
- New RPC get_public_stops_for_brand (migration 148) for public storefront stops
- New server action getPublicStopsForBrand with revalidate=300 + tags
- Add revalidateTag invalidation to createStopsBatch + publishStop
- Convert /tuxedo/stops and /indian-river-direct/stops to Server Components
- Extract TuxedoStopsList + IndianRiverStopsList as client islands (GSAP only)
- Removes supabase-js from browser bundle on those routes
- Both pages now statically prerendered (5m ISR)

Parallel agent changes also staged:
- AI provider model list refresh (claude-sonnet-4-5, etc.)
- ESLint directive patches for react-hooks/set-state-in-effect
- Admin + storefront + checkout + cart updates
- New admin_create_stop_rpcs migration (147)
- Misc fixes across ~90 files

Build verified: typecheck clean, lint clean on new files, production build succeeds.
This commit is contained in:
2026-06-03 02:04:21 +00:00
parent 57da01c786
commit 1fe5ffee8d
95 changed files with 1470 additions and 733 deletions
+17 -18
View File
@@ -38,26 +38,25 @@ export async function createStop(
}
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!;
const supabaseKey = process.env.SUPABASE_SERVICE_ROLE_KEY!;
// Use anon key — the RPC is SECURITY DEFINER so it bypasses RLS regardless
// of caller. This also means a missing SUPABASE_SERVICE_ROLE_KEY in
// production no longer breaks stop creation.
const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!;
const slug = `${data.city.toLowerCase().replace(/\s+/g, "-")}-${data.date || new Date().toISOString().slice(0, 10)}`;
const res = await fetch(`${supabaseUrl}/rest/v1/stops`, {
const res = await fetch(`${supabaseUrl}/rest/v1/rpc/admin_create_stop`, {
method: "POST",
headers: { ...svcHeaders(supabaseKey), "Content-Type": "application/json", Prefer: "return=representation" },
headers: { ...svcHeaders(supabaseKey), "Content-Type": "application/json" },
body: JSON.stringify({
city: data.city,
state: data.state,
location: data.location,
date: data.date,
time: data.time,
slug,
brand_id: brandId,
active: data.active ?? false,
address: data.address ?? null,
zip: data.zip ?? null,
cutoff_time: data.cutoff_time ?? null,
status: "draft",
p_brand_id: brandId,
p_city: data.city,
p_state: data.state,
p_location: data.location,
p_date: data.date,
p_time: data.time,
p_address: data.address ?? null,
p_zip: data.zip ?? null,
p_cutoff_time: data.cutoff_time ?? null,
p_active: data.active ?? false,
}),
});
@@ -67,5 +66,5 @@ export async function createStop(
}
const inserted = await res.json();
return { success: true, id: inserted[0]?.id ?? "" };
return { success: true, id: inserted?.id ?? "" };
}