Debug an Angular UI from user reports
I was asked this
No reports yet. Sign in to say where you were asked it.
A coding interview question asked in Waymo's coding round, last asked May 2026. It tests frontend, angular and debugging.
You are given an existing Angular component and a few concrete user bug reports about it. Reproduce each failure, find the cause in the code, fix it with a small change and show that it stays fixed. Work only from the code and the reports; don't assume details you can't see.
Interface
Unless you agree on a different interface with the interviewer, assume:
- A component (template, class and service), its existing tests, and three or four reports of the form "When I do X, I expect Y, but I see Z."
- For each report you deliver: the steps that reproduce it, the cause, a failing test that becomes green, and the minimal fix.
Example
Report: "After I leave the page and come back, every update shows up twice."
Repro: navigate away and back, trigger one update, see two entries.
Cause: a subscription made in ngOnInit is never unsubscribed, so each visit adds a listener.
Fix: takeUntilDestroyed() (or unsubscribe in ngOnDestroy); a test that mounts twice and expects one entry.
(The example shows the shape of an answer; the real reports come from the interviewer.)
Constraints
- Change as little as possible; keep the component's public inputs and outputs.
- Every fix gets a regression test.
Clarifying questions
- Which Angular version, and is the component using
OnPushchange detection or signals? - Can I run the app and the tests locally?
- Are the reports for one browser, or all?
- Is changing the service in scope, or only the component?
What a strong answer covers
- Reproducing first, then narrowing: the template binding, the component state, the lifecycle hook, or the async source.
- Typical causes named precisely: leaked subscriptions, mutating an input so
OnPushnever re-renders, a missing or wrongtrackBy, a race between overlapping requests, work done in the constructor instead ofngOnInit. - A failing test written before the fix, then the minimal fix.
- Checking nearby cases: async cleanup on destroy, keyboard and screen-reader behaviour, empty and error states.
- Explaining the reasoning aloud as you go.
Follow-ups
- One report can't be reproduced. What do you do next?
- How would you stop this class of bug from coming back across the codebase?
- The fix needs a change in a shared service other teams use.
Where it's asked
- Waymo · Coding · Last asked May 202645 min · Usually two rounds; some give you the interviewer's buggy code to find and fix, some are read aloud with no skeleton
What it tests
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
