All jobs / Full-stack developer / Frontend
Full-stack developer interview question · 1–3 years
A long profile form is open. The user hits Save and the network is slow.
What does the form do?
The strongest answer
Disable submit while in flight, keep the draft if the call fails, and warn before leave if they still have unsaved edits
Why it works
Exactly. Three bugs, one widget: double-submit, lost draft, and a closed tab. Handle all three.
What a good answer covers
- Lock the button for the request.
- Keep the draft on failure.
- Warn on leave if dirty.
- Do not empty the form on click.
Answers that fall short
- Close, but not the strongest: Clear the form as soon as they click Save
Clearing on click throws away their words if the API 500s. - Weak: Allow double-click; the API should be fast
Double-click plus a slow API is two rows. Disable is cheaper than unique constraints as a UX. - Red flag: Use `beforeunload` only and skip in-flight locking
`beforeunload` does not stop a second click. You need both.
Who gets asked this
More Frontend questions
- Two people edit the same note. The second save returns 409 Conflict. What does the UI do with 409?
- A teammate throws inside `fetch` so the React error boundary can show the outage. What is the difference?
- A burst of autosaves returns 429 from the API gateway. What does the UI do with 429?
- The first screen is a list loaded from `GET /items`. What states does the screen need?
- Saving a profile can fail with a 400 (`email taken`) or a 500. What does the UI show?
- The user submits 'create project'. A teammate wants the new card to appear before the response. When do you…
- The API process is down. The UI still loads. What should the UI do?
- A Next-style SSR page flashes and React logs a hydration mismatch on the header. What do you fix first?