All quizzesHard
Edge Rendering — Series 2
Preview — 3 of 10 questions
"use cache" can go at the top of a file or inside one async function. What is the difference?
AFile-level "use cache" makes every exported async function in that file its own independent cache entry (keyed by that function's own arguments); function-level "use cache" caches just that one function. Same mechanism, different granularity
BFile-level caching disables per-function caching
CFunction-level "use cache" is not supported
DPlacement is purely stylistic with identical behaviour
A Server Action charges a payment, then creates an order. Step 2 fails after step 1 succeeds. Server Actions do not roll back external side effects. What is correct?
AWrap both in one try/catch and ignore step 2's error since step 1 succeeded
BRely on Next.js's automatic Server Action retry to redo step 2
CUse an idempotency key on the charge and a compensating action if the order write fails — issue a refund or write a "needs reconciliation" record — because a database transaction can only make the DB write atomic, not the external payment call
DMove the payment charge into a client useEffect after the action returns
middleware.ts rewrites tenant-a.example.com and tenant-b.example.com to the same app/page.tsx. How do you keep the Data Cache from serving tenant A's data to tenant B?
AShared-codebase multi-tenancy is impossible in Next.js
BInclude the tenant identifier in the cache key — put it in the fetch URL, the unstable_cache key array, or a tag like tenant-${id}-products — so each tenant's data is cached under a distinct key
CSet revalidate = 0 globally so nothing is cached
DRely on NextResponse.rewrite() to namespace the cache per origin
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.