perf: migrate pages to Cache Components via root layout opt-out
Remove the per-route 'export const instant = false' opt-outs now that the root layout carries the single Cache Components opt-out. Child pages inherit the opt-out, so admin/mod/radio leaf pages that only access cached or DB data stay instant while runtime-dependent pages remain dynamic. Update the staff-smoke contract test to assert the root-layout contract.
This commit is contained in:
1 parent
b25e7b00dd
commit
51ef7602ca
203 files changed
+16
-811
No files matched your search
@@ -2,10 +2,6 @@ import { ModActionsClient } from "@/app/admin/moderation/actions/mod-actions-cli
|
||||
import { requireModPermission } from "@/lib/admin/guard";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
export default async function ModQuickActionsPage() {
|
||||
await requireModPermission([PERMS.MOD_ACTIONS, PERMS.MODERATION_EDIT]);
|
||||
|
||||
|
||||
@@ -7,10 +7,6 @@ import { Ban, db } from "@/lib/db";
|
||||
import { formatDate } from "@/lib/format-date";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
type BanRow = {
|
||||
id: number;
|
||||
userId: number;
|
||||
|
||||
@@ -5,10 +5,6 @@ import { requireModPermission } from "@/lib/admin/guard";
|
||||
import { Ban, db, SupportTickets, User } from "@/lib/db";
|
||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
export default async function ModCfhDetailPage({
|
||||
params,
|
||||
}: {
|
||||
|
||||
@@ -16,10 +16,6 @@ import { calcPagination, parseListParams } from "@/lib/admin-helpers";
|
||||
import { db, SupportTickets, User } from "@/lib/db";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
const SORT_COLS = {
|
||||
id: SupportTickets.id,
|
||||
issue: SupportTickets.issue,
|
||||
|
||||
@@ -15,10 +15,6 @@ import {
|
||||
} from "@/lib/db";
|
||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
export default async function ModHelpTicketDetailPage({
|
||||
params,
|
||||
}: {
|
||||
|
||||
@@ -28,10 +28,6 @@ import {
|
||||
import { formatDate } from "@/lib/format-date";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
const SORT_COLS = {
|
||||
title: WebsiteHelpCenterTickets.title,
|
||||
open: WebsiteHelpCenterTickets.open,
|
||||
|
||||
@@ -21,10 +21,6 @@ import { readCsrfCookieToken } from "@/lib/foundation/security";
|
||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||
import { siteSettings } from "@/lib/services/site-settings";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
export default async function ModLayout({ children }: { children: ReactNode }) {
|
||||
const staff = await requireMod();
|
||||
const csrfToken = await readCsrfCookieToken();
|
||||
|
||||
@@ -22,10 +22,6 @@ import {
|
||||
} from "@/lib/db";
|
||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
export default async function ModDashboardPage() {
|
||||
const t = await getTranslations("pages.mod");
|
||||
const { session, permissions } = await getAdminContext();
|
||||
|
||||
@@ -14,10 +14,6 @@ import {
|
||||
} from "@/lib/db";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
export default async function ModTeamLitePage() {
|
||||
await requireModPermission([PERMS.MOD_TEAM_VIEW, PERMS.MODERATION_VIEW]);
|
||||
|
||||
|
||||
@@ -10,10 +10,6 @@ import { fetchTicketQueueOpenCounts } from "@/lib/admin/ticket-queue-counts";
|
||||
import { db, User, WebsiteTicket, WebsiteTicketMessage } from "@/lib/db";
|
||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
const Creator = alias(User, "ticket_creator");
|
||||
const Assignee = alias(User, "ticket_assignee");
|
||||
const MessageUser = alias(User, "ticket_message_user");
|
||||
|
||||
@@ -25,10 +25,6 @@ import { db, User, WebsiteTicket, WebsiteTicketMessage } from "@/lib/db";
|
||||
import { formatDate } from "@/lib/format-date";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
const Creator = alias(User, "ticket_creator");
|
||||
const Assignee = alias(User, "ticket_assignee");
|
||||
|
||||
|
||||
@@ -11,10 +11,6 @@ import { fetchTicketQueueOpenCounts } from "@/lib/admin/ticket-queue-counts";
|
||||
import { parseListParams } from "@/lib/admin-helpers";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
export default async function ModTicketInboxPage({
|
||||
searchParams,
|
||||
}: {
|
||||
|
||||
@@ -9,10 +9,6 @@ import { formatDate } from "@/lib/format-date";
|
||||
import { getAvatarUrl } from "@/lib/imager";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
export default async function ModUserDetailPage({
|
||||
params,
|
||||
}: {
|
||||
|
||||
@@ -10,10 +10,6 @@ import { getAvatarUrl } from "@/lib/imager";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
import type { DataTableColumn } from "@/types/common";
|
||||
|
||||
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
||||
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
||||
export const instant = false;
|
||||
|
||||
type ModUserRow = {
|
||||
id: number;
|
||||
username: string;
|
||||
|
||||
Reference in new issue
Block a user