* feat: upgrade apps/web to Next.js 16.1.0 Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: enable Turbopack for Next.js 16.1 production builds - Add turbopack: {} config to next.config.js to enable Turbopack for builds - Fix re-exported config errors in webhook API routes by defining config locally - alby/webhook.ts - btcpayserver/webhook.ts - paypal/webhook.ts - stripepayment/webhook.ts Turbopack requires route segment configs to be statically analyzable, so they cannot be re-exported from other modules. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: update revalidateTag calls for Next.js 16.1 API changes Next.js 16.1 changed the revalidateTag signature to require a second argument (profile). Using 'max' profile as recommended by Next.js docs for stale-while-revalidate semantics. Updated files: - app/(booking-page-wrapper)/team/[slug]/[type]/actions.ts - app/(use-page-wrapper)/(main-nav)/teams/actions.ts - app/(use-page-wrapper)/settings/(settings-layout)/developer/api-keys/actions.ts - app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/actions.ts - app/(use-page-wrapper)/settings/organizations/(org-user-only)/members/actions.ts - app/cache/travelSchedule.ts Also cleaned up next.config.js turbopack config formatting. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add profile parameter to revalidateTag in membership.ts for Next.js 16.1 Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix routing form * refactor: rename middleware.ts to proxy.ts per Next.js 16 migration Next.js 16 has deprecated the 'middleware' file convention and renamed it to 'proxy'. This change follows the official migration guide: https://nextjs.org/docs/messages/middleware-to-proxy Changes: - Renamed apps/web/middleware.ts to apps/web/proxy.ts - Renamed the middleware function to proxy - Updated CODEOWNERS reference - Updated comment reference in logout page Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Anik Dhabal Babu <adhabal2002@gmail.com> Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
28 lines
791 B
TypeScript
28 lines
791 B
TypeScript
"use server";
|
|
|
|
import { revalidateTag, unstable_cache } from "next/cache";
|
|
|
|
import { MembershipRepository } from "@calcom/features/membership/repositories/MembershipRepository";
|
|
import { NEXTJS_CACHE_TTL } from "@calcom/lib/constants";
|
|
|
|
const CACHE_TAGS = {
|
|
HAS_TEAM_PLAN: "MembershipRepository.findFirstAcceptedMembershipByUserId",
|
|
} as const;
|
|
|
|
export const getCachedHasTeamPlan = unstable_cache(
|
|
async (userId: number) => {
|
|
const hasTeamPlan = await MembershipRepository.findFirstAcceptedMembershipByUserId(userId);
|
|
|
|
return { hasTeamPlan: !!hasTeamPlan };
|
|
},
|
|
["getCachedHasTeamPlan"],
|
|
{
|
|
revalidate: NEXTJS_CACHE_TTL,
|
|
tags: [CACHE_TAGS.HAS_TEAM_PLAN],
|
|
}
|
|
);
|
|
|
|
export const revalidateHasTeamPlan = async () => {
|
|
revalidateTag(CACHE_TAGS.HAS_TEAM_PLAN, "max");
|
|
};
|