Skip to content
Chapter 94Lesson 8

Quiz - Performance vigilance

Quiz progress

0 / 0

You ship a fix at 9am and want to know within the hour whether it improved performance. Why can’t you rely on the Speed Insights field score to tell you?

The field score is a trailing 28-day p75 of real traffic, so a same-day change won’t visibly move it for a week or two.
Speed Insights only updates its dashboard once a day, so you’d see the change tomorrow morning.
Field data is averaged across all users, so a single deploy is too small a sample to register.

A marketing page has a small header logo (first in the DOM), a full-bleed hero photo, and two product thumbnails — all above the fold. To improve LCP, which gets the preload prop?

Only the full-bleed hero photo — it’s the largest painted element, and preload is a fixed budget you spend on one image.
The header logo, because it’s first in the DOM and the browser discovers it earliest.
All three — they’re above the fold, so front-loading every one makes the page paint sooner.

You add experimental.optimizePackageImports to next.config.ts. Which packages actually belong in that list?

Libraries Next.js doesn’t already optimize — most often your own internal packages — since lucide-react, date-fns and friends are on the default list already.
Every multi-export dependency you import, including lucide-react and date-fns, to be safe.
Only CommonJS packages like plain lodash, since those are the ones that can’t be tree-shaken.

In the production bundle treemap, the single biggest tile is the React + Next runtime. What’s the right move?

Leave it — the framework runtime is the floor every app pays, not an optimization target.
It’s the biggest tile, so it’s the highest-value fix — trace its import chain and trim it.
Code-split it with dynamic() so it only loads on routes that need it.

Your Lighthouse report shows green LCP and CLS. Why does it never show you an INP value?

Lighthouse is a synthetic load with no user clicking anything, so there’s no interaction to measure — it reports TBT as a partial lab proxy instead.
Lighthouse measures INP but only surfaces it when it crosses the poor threshold, to reduce noise.
INP only applies to authenticated pages, and Lighthouse audits the marketing page by default.

You wrap two co-located Server Component awaits in Promise.all, but the second read actually needed the first’s value. What happens?

No error — the second read runs with undefined and quietly produces wrong data.
Promise.all throws immediately because it detects the missing dependency.
The build fails, because Next.js validates await dependency order at compile time.

In a production trace, the invoice list is one fat 280ms span while the audit-log page is a staircase of fifty thin spans. Match each signature to its structural fix.

Fat span → add the composite (organization_id, …) index; staircase → collapse the N+1 with Drizzle with or a join.
Fat span → collapse the N+1; staircase → add the missing index.
Both → wrap the queries in 'use cache' so warm requests skip the latency.

Quiz complete

Score by topic