Lesson 17 of 30
A typical API call feels instant; an AI response can take seconds before the first token even arrives — a plain spinner isn't good enough for a wait that long, and this lesson is about the patterns that are.
11 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 3
A chat feature streams tokens as they arrive instead of waiting for the full response. Does this reduce the total time until the response finishes?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
Most API calls a frontend developer builds around complete in well under a second, and a generic loading spinner is fine for that. An AI completion is a different order of magnitude: even with streaming, there's real latency before the first token arrives (the model has to process the whole prompt before it can start generating), and a non-streamed response can take several seconds to finish entirely. A spinner that's appropriate for a 200ms fetch reads as broken or frozen once the wait stretches past a second or two.
This is a UX problem with real patterns, not just an engineering one:
[Immediate] "Thinking…" <- distinct from a generic spinner
[~1-2s later] "Searching your documents…" <- intermediate status, not silence
[~3s later] "Found 4 relevant sections. Drafting…"
[~4s later] "Based on the error logs, the issue |" <- streaming begins, text grows token by token
Each stage tells the user something true about what's happening right now. Compare that to a single spinner shown for the entire four seconds: functionally the same total wait, but the user has no way to distinguish "still working normally" from "hung." That distinction is the whole reason latency needs deliberate UX handling instead of being treated like any other loading state.
"A user says the AI feature feels slow — what would you check, and what would you change?" is a real question that separates candidates who only reach for "add a spinner" from ones who can name streaming, staged status, and the perceived-vs-actual latency distinction as the actual levers.