Skip to content

    Frontend System Design

    Front-End Case Study: Gmail-Style Email Client

    Design the front end of a web email client: threads and labels, optimistic actions with undo, bulk selection, delta sync and draft autosave, with a lab.

    By Published 20 min read

    • frontend-system-design
    • case-study
    • email
    • optimistic-ui
    Share

    Case studyadvancedReact labFrontend System Design

    Before this: How to Read and Reproduce a Front-End Case Study, List Virtualization, State Persistence and Synchronization

    What you'll learn: By the end of this case study you will be able to design the client side of a web email client: model threads and labels instead of folders, keep the server's state and the user's pending actions apart and lay one over the other, give destructive actions an undo window, decide what happens when a new message arrives on a thread the user just acted on, select many threads with a range, apply server changes with a version check, and autosave a draft without ever hiding an edit.

    Picture a filing cabinet where nothing is ever moved. Instead of dragging a letter from the "Inbox" drawer to the "Archive" drawer, you stick coloured labels on it and the cabinet shows you all the letters with a given label. Now add a clerk who files incoming letters while you work, and a rule that a letter you "put away" must come back if a reply lands on it. That is the shape of an email client: labels on conversations, a server that changes underneath you, and your own half-finished actions laid over it.

    This is an educational reference design, not the verified internal architecture of Gmail or of any other email product. The title names the familiar shape of a conversation-based web client; nothing here is claimed about how any company builds it. Every number is illustrative, and the lab at the end is a model with no mail server and no network.

    The method (requirements, estimates, layers, deep dives, failure modes, a decision record) follows the case-study method lesson, which is planned and not yet published. The general techniques this case leans on are in Optimistic Updates and Rollback, List Virtualization and State Persistence and Synchronization.

    The core idea

    1. The screen is the server's state with the user's pending actions laid over it. Keep two things: base, what the server last confirmed, and ops, an ordered list of what the user did that is not confirmed. What you draw is base with ops applied. Confirming an operation folds it into base; rejecting it deletes it from the list, and the operations after it stay in place. Nothing is ever "restored from a snapshot".
    2. Mail is conversations and labels. A thread groups messages; a label is a tag, not a place. "Archive" removes one label, "trash" swaps one, "star" adds one, "read" clears a flag. Every action is a small, repeatable edit of a thread.
    3. Changes from the server arrive as versioned deltas. A delta applies only on top of the version it was computed from. If it does not, the client does not guess; it asks for the whole list again.

    Three illustrations run through the lesson: a minimal example (archive one thread, then undo), a realistic example (a busy inbox with a bulk archive while new mail arrives) and a failure example (a thread that was archived on screen and received a reply a moment later).

    Requirements and scope

    Functional. A mailbox list (inbox, starred, trash) with unread counts. A conversation list ordered by newest activity, with a search box. Selecting one or many conversations and acting on them: archive, trash, mark read or unread, star. A short undo after archive and trash. A compose window with autosave and an undo-send delay. New mail appearing without a reload.

    Non-functional. Actions must feel instant and be correct when the server refuses. The list must stay fast with tens of thousands of conversations (windowing). The app must survive a flaky connection and a closed tab without losing a draft. Selection and bulk actions must be usable by keyboard and screen reader.

    Out of scope here. Rendering arbitrary HTML bodies at full fidelity (touched in one section), attachments, rich-text editing, contacts, filters and rules, and the server side of mail delivery. The protocol and storage of mail are a back-end topic; this lesson takes the client's view.

    Illustrative sizing

    The numbers below are assumptions for reasoning, not measurements.

    Quantity Assumed value Why it matters
    Conversations the user can reach 50,000 Only a window of rows may exist in the DOM
    Conversation headers held in memory 2,000 Enough for scrolling and search-as-you-type on recent mail
    Pending operations at one time under 20 The overlay is recomputed often, so it must stay cheap
    Threads in one bulk action up to 100 One operation, one request, one undo
    Draft saves per minute while typing about 6 Debounce, or every keystroke becomes a request

    With these assumptions the data is small and the risks are about consistency: what the user sees against what the server holds while both change.

    The architecture: server state, pending operations and a sync layer

    Figure 1. The layers of a web email client

    A web email client: the screen shows server state with pending operations laid over it; a sync layer carries effects and deltasMail UI to Mail core (events); Mail core to Mail UI (state); Mail core to Sync layer (send-op effect); Sync layer to Mail server (requests); Mail server to Sync layer (deltas); Sync layer to Mail core (confirm, delta); Mail core to Local cache (persist)Mail UI: thin ReactMail UIthin ReactMail core: base plus opsMail corebase plus opsSync layer: requests, deltasSync layerrequests, deltasLocal cache: IndexedDBLocal cacheIndexedDBMail server: versioned stateMail serverversioned stateeventsstatesend-op effectrequestsdeltasconfirm, deltapersist

    How to read this: the core is the only box with rules, and it never touches the network. It emits effects such as "send this operation" or "save this draft" and receives confirmations and deltas as events, which makes every awkward ordering testable without a server.

    The data model: conversations, labels and flags

    A message is a small document; a conversation is a list of them. The email message format gives the raw material for grouping: a Message-ID header "provides a unique message identifier that refers to a particular version of a particular message", an In-Reply-To header identifies the message a new one answers, and References "may be used to identify a 'thread' of conversation" (RFC 5322, section 3.6.4). The JMAP mail specification builds on that: a Thread is "a flat list of Emails, ordered by date", every email belongs to exactly one thread even if alone, and "the exact algorithm for determining whether two Emails belong to the same Thread is not mandated" (RFC 8621, section 3). The reference design leaves grouping to the server and works with conversations.

    Folders versus labels is the other modelling choice. JMAP says an email "MUST belong to one or more Mailboxes at all times" and carries per-message keywords such as $seen ("the Email has been read") and $draft (RFC 8621, section 4.1.1). So moving mail is changing a set of mailbox memberships, and reading is a keyword. The lab uses the same idea in a simpler form: a thread has a labels list and an unread flag, and each action is a function from thread to thread.

    Action What it does to a thread Undo window
    Archive Removes the inbox label Yes
    Trash Removes inbox, adds trash Yes
    Mark read, unread Sets the unread flag No
    Star, unstar Adds or removes the starred label No

    Store threads by id in one map (see Derived and Normalized State) and compute the visible list from it: filter by the current label and the search text, sort by newest first. A list that is a function of the state cannot go stale when an operation is added or removed.

    Optimistic operations laid over the server's state

    When the user selects three threads and presses Archive, the core does not edit base. It creates an operation: its kind, the thread ids, the date each thread had at that moment, a phase (held or sent) and a send time. The screen shows base with all operations applied in order, so the three threads vanish at once.

    For archive and trash the operation is held for a short window (5 seconds in the lab, an assumption) and no request is made. If the user presses Undo inside the window, the operation is deleted and nothing was ever sent. When the window ends, the core emits one send-op effect and marks the operation sent. Flags such as read and star go out immediately, because they are cheap to reverse and a delay would feel broken.

    Figure 2. The life of an archive operation

    stateDiagram-v2 accTitle: Lifecycle of an optimistic archive operation accDescr: An operation starts held. Undo inside the window removes it. When the window ends it is sent. A confirmation folds it into the server state and removes it from the pending list. A rejection removes it from the pending list without folding, which puts the thread back. [*] --> Held: user acts, shown at once Held --> Removed: undo inside the window Held --> Sent: window ends, one request Sent --> Folded: server confirms Sent --> Removed: server rejects, toast Folded --> [*] Removed --> [*]

    How to read this: there are two ways to leave the pending list. Folded means the server agrees and the screen does not change; removed means the screen goes back to what the server holds, plus every other pending operation.

    Why not simply snapshot the list before the action and restore it on failure? Because a second operation may have been added after the first. Restoring the snapshot would throw it away; removing only the failed operation from the list keeps it. The lab's test "reject puts the thread back and says why, and later operations stay laid over the server state" checks exactly this: a rejected archive returns its thread to the inbox while a later star on another thread stays.

    Figure 3. One archive, three outcomes

    sequenceDiagram accTitle: Archive with undo, confirm and reject accDescr: The user archives a thread and the client hides it and holds the operation. If the user presses undo inside the window the thread returns and nothing is sent. Otherwise the window ends and the client sends one request. If the server confirms, the operation is folded into the server state. If it rejects, the client removes the operation and shows a message. participant U as User participant C as Mail core participant S as Server U->>C: archive thread t2 C->>C: hold operation, hide t2 alt undo inside the window U->>C: undo C->>C: remove operation, show t2 else window ends C->>S: archive [t2] alt confirmed S-->>C: ok C->>C: fold into server state else rejected S-->>C: error C->>C: remove operation, show t2, toast end end

    How to read this: the client talks to the server in only one branch. Undo is free because the request was never made.

    The new-message rule

    The failure example is easy to miss. The user archives a thread; before the window ends, a reply arrives for that thread. If the pending archive were applied to the thread as it now is, the reply would be hidden from the inbox, and the user, who never saw it, would not know it exists.

    The reference design stores the thread's date (newest message) in the operation as seenDate. An operation applies to a thread only if the thread's date is not newer than the one the user acted on. A thread that got a newer message is left alone, in two places: it is not hidden on screen, and it is left out of the request when the window ends. An operation whose every thread has become stale is dropped. The same rule makes "mark as read" safe: a pending read does not mark a new, unseen message as read.

    This is a design decision, not a standard. It trades "the action took effect" for "the user is not surprised", and it is cheap because the date is already on the thread.

    Selection and bulk actions

    Selecting many threads is a small state machine: a set of ids and an anchor, the most recently clicked row. A plain click selects only that row. A toggle (Ctrl or Command click, or the checkbox) adds or removes one and moves the anchor. A range click (Shift) selects every row between the anchor and the clicked row in the order of the visible list, which means the list order and any active search must be known to the selection code. Select all means "everything visible", which depends on the search text.

    Three rules keep it correct.

    • Prune after every event. A thread that leaves the view, because it was archived or changed label, leaves the selection. Otherwise a toolbar would show "3 selected" with one row on screen.
    • Clear after acting. The selection is consumed by the operation.
    • Decide what "all" means. Ids on screen, or every conversation matching the search? The second is a different request (a query, not a list) and its confirmation must say how many conversations it will touch. The lab models the first and leaves the second as a stretch exercise.

    The keyboard model matters as much as the mouse. The ARIA Authoring Practices listbox pattern says a multi-select listbox sets aria-multiselectable="true", and describes optional keys: Shift plus Space selects contiguous items from the most recently selected item to the focused item, and Control plus A selects all. A mail list is not necessarily a listbox, but the range and select-all behaviours are the same ones users expect from it. Keyboard and screen-reader details are in Keyboard, Focus and Screen Readers.

    Syncing: versions, deltas and a full resync

    New mail, changes made on another device and confirmations all reach the client as server state. The JMAP core specification describes a pattern worth borrowing: every data type has a state string, "if the data changes, this string MUST change", and when a client sees a different state it must either throw away its cache or ask for the changes since the old state with a /changes call (RFC 8620, section 5.1). If the server cannot compute the changes from the state the client gives, it returns cannotCalculateChanges and "the client MUST invalidate its cache" (section 5.2). Servers are expected to calculate changes from any state given to a client within the last 30 days, which is a reminder that old versions are eventually forgotten. A write can also be made conditional with ifInState, which fails with stateMismatch if the state moved (section 5.3).

    The reference core uses the same idea in miniature. Each delta carries from and to versions.

    Figure 4. What the core does with a delta

    flowchart TD accTitle: Decision for an incoming delta accDescr: Compare the delta's from version with the client's current version. If they match, apply the upserts and deletions and move to the new version. If they differ, the client missed a change, so it asks for the whole list once and ignores further deltas until the full list arrives. A[Delta arrives: from F, to T] --> B{F equals my version?} B -->|yes| C[Apply upserts and deletions, version becomes T] B -->|no| D{Already waiting for a full list?} D -->|no| E[Emit resync once] D -->|yes| F[Ignore it] E --> G[Full list arrives: replace base, keep pending ops]

    How to read this: the client never applies a delta on top of the wrong version. Pending operations are kept across the resync, so the user's undo window and unconfirmed actions survive it.

    Where a bidirectional merge is needed, for example edits on two devices, see Offline-First Sync and Conflict Resolution; mail is the easy case because the main edits (labels, flags) commute and the server decides.

    Drafts: autosave without hiding an edit

    A draft is a document the user is writing, so the questions are when to save and what "saved" means.

    When. Not on every keystroke: wait until the typing has paused (1.5 seconds in the lab, an assumption) and do not start a save while another is in flight. This is a debounce; see Debouncing and Throttling. The lab uses a periodic tick fed by the caller, because the core owns no clock.

    What "saved" means. Each edit bumps a revision. A save request carries a revision and its answer says which one was stored. The draft is clean only if the answered revision is the newest one: if the user typed while the save was in flight, the answer for revision 1 must not hide the fact that revision 2 exists. The status line therefore reads from three numbers: the current revision, the saved revision and the one being saved.

    When the user leaves. Closing a tab does not wait for a debounce. MDN says transitioning to hidden is "the last event that's reliably observable by the page" and recommends sending data on visibilitychange; navigator.sendBeacon() queues a small POST, limited to about 64 KiB, without delaying unload, and returns true only if the browser queued it, which does not prove the server received it. So the reference core has a leave event that emits an immediate save when something is unsaved and nothing is in flight, and a draft that is too large for a beacon must be saved earlier or locally.

    Undo send. Sending is held for a window (10 seconds in the lab) with the body frozen; undo returns the draft to editing, and when the window ends the core emits one submit-draft effect. It is the same held-operation idea applied to the compose window.

    Figure 5. The life of a draft

    stateDiagram-v2 accTitle: Lifecycle of a draft accDescr: A draft is editing and may be unsaved, saving or saved. An edit makes it unsaved with a new revision. After a pause with no save in flight it is saving. The answer for the newest revision makes it saved; an answer for an older revision leaves it unsaved. Pressing send holds it for a window, during which undo returns it to editing, and when the window ends it is submitted. [*] --> Unsaved: edit, new revision Unsaved --> Saving: pause, no save in flight Saving --> Saved: answer for newest revision Saving --> Unsaved: answer for older revision Saving --> Failed: save fails Failed --> Saving: retry after a pause Saved --> Unsaved: edit Saved --> Held: press send Unsaved --> Held: press send Held --> Unsaved: undo send Held --> [*]: window ends, submitted

    How to read this: edits keep returning the draft to "unsaved", and only an answer for the newest revision can leave that state. Failure is a visible state with its own retry delay, not a silent loop.

    Rendering a message body, search and long lists

    Message bodies are other people's HTML. A conservative reference answer is to render each body in a sandboxed iframe. MDN says the sandbox attribute, when empty, applies all restrictions; allow-scripts lets scripts run; and combining allow-scripts with allow-same-origin on a same-origin document is "strongly discouraged" because the embedded document can remove the sandbox. srcdoc embeds inline HTML and MDN names its combination with sandbox as a technique to prevent script injection when displaying user-generated content. The referrerpolicy attribute controls what referrer is sent when fetching the frame's resource. Remote images and links raise privacy questions that this lesson does not settle; the principle is that the mail body never runs with the app's privileges. See XSS Defenses and Content Security Policy.

    Search has two layers. Typing filters the headers already in memory at once (the lab does a case-insensitive match on subject, sender and snippet) and a server query covers what is not loaded; the lesson's rule is that the local result must never claim to be complete. A long list is windowed, and the selection code must work in terms of ids and the visible order, not DOM nodes, because rows that are off screen do not exist.

    Build it: operations, selection, deltas and drafts

    Goal. Drive the mailbox core through an archive with undo, a rejection, a bulk action with a late reply, a missed delta and a draft that is edited while a save is in flight.

    Setup. The lab email-client-model is in the course's example workspace (Node 26). It is new and does not duplicate the others: offline-outbox persists and retries writes, optimistic-update shows one rollback, list-virtualization windows rows and offline-first-sync merges two writers. Here the core is one pure function, step(state, event); a small store and a React component MailApp read it with useSyncExternalStore. Nothing runs against a mail server or a real browser.

    cd examples/frontend
    pnpm install
    cd labs/email-client-model
    pnpm test           # 35 tests: 28 for the core, 7 React (jsdom)
    node src/demo.ts

    Steps.

    1. Run the tests, then the demo. In section 2, the archive was sent and the server says no. Only that operation leaves the list; the thread comes back and the later "mark read" stays.

    Expected output, captured from a real run (Node 26.13.1; section 2):

    === 2. The server says no: only that operation is taken back
      mark t3 read (goes out at once)
          effect: send-op #3 read [t3]
          inbox: [t4 t3 t1*]  (* = unread, unread 1)  pending ops: #2 archive sent; #3 read sent
      server rejects the archive (#2)
          effect: toast "Could not archive 1 conversation(s): mailbox is busy"
          inbox: [t4 t3 t2* t1*]  (* = unread, unread 2)  pending ops: #3 read sent
      server confirms the read (#3)
          inbox: [t4 t3 t2* t1*]  (* = unread, unread 2)  pending ops: none
    1. In section 3, the user archives three threads with a range selection. A new message then arrives on one of them. It reappears in the inbox, and when the window ends the request lists only the other two.

    Expected output, captured from a real run (Node 26.13.1; section 3):

    === 3. Bulk selection with a range, then a new message arrives on a thread being acted on
      click t4
      shift-click t2
          selected: t4,t3,t2
      archive the selection at t=4000
          inbox: [t1*]  (* = unread, unread 1)  pending ops: #4 archive held
      delta v1 -> v2: a new message on t2 (date 99)
          inbox: [t2* t1*]  (* = unread, unread 2)  pending ops: #4 archive held
      the undo window ends (t=9000): t2 is left out of the request
          effect: send-op #4 archive [t4,t3]
          inbox: [t2* t1*]  (* = unread, unread 2)  pending ops: #4 archive sent
    1. In section 4, a delta that starts from a version the client does not have makes it ask for a full list once; a second such delta asks for nothing. The pending operation survives the resync.

    Expected output, captured from a real run (Node 26.13.1; section 4):

    === 4. Delta sync: a delta that does not start from our version means we missed one
      delta v7 -> v8 (we are on v2)
          effect: resync (fetch the whole list)
      a second out-of-order delta asks for nothing more
      full list arrives
          inbox: [t9* t2*]  (* = unread, unread 2)  pending ops: #4 archive sent
    1. In section 5, the user types a second edit while the first save is in flight. The answer for revision 1 leaves the draft "Not saved yet", and a second save for revision 2 follows after a pause.

    Expected output, captured from a real run (Node 26.13.1; section 5):

    === 5. Draft autosave: debounce, a save answered after a newer edit, and undo send
      compose at t=0
      type 'Hi' at t=100
      tick t=1000 (still typing, too soon)
      tick t=1600 (pause long enough)
          effect: save-draft d1 rev 1 "Hi"
      type 'Hi Sam' at t=1700 while the save is in flight
      server answers rev 1
          status: Not saved yet
      tick t=3300
          effect: save-draft d1 rev 2 "Hi Sam"
      server answers rev 2
          status: Saved
      press Send at t=4000
          status: Sending in 10 s
      press Undo send at t=6000
      press Send again at t=7000, window passes
      tick t=17000
          effect: submit-draft d1 "Hi Sam"
          effect: toast "Message sent"

    What the lab does not show. No mail server, no protocol, no real clock, no storage and no HTML rendering. Delays (5 s undo, 10 s undo-send, 1.5 s autosave debounce) are the lab's choices. The delta rules follow the idea in JMAP but are not an implementation of it. Operations are assumed to be confirmed or rejected as a whole.

    Break it. In src/mailbox.ts, in applyOp, delete the line that starts if (t.date > (op.seenDate. A pending read or archive now also applies to a thread with a newer message; one test fails. Restore the line and run the tests again.

    Trade-offs

    Decision Option A Option B Reference choice
    Optimistic failure Restore a snapshot Remove the operation from an ordered list Remove the operation: later actions survive
    Destructive actions Confirm dialog Short undo window Undo window: faster, and nothing is sent if undone
    New mail on an acted-on thread Apply the action anyway Leave the thread alone Leave it alone: the user never saw the reply
    Server changes Refetch the list on any change Versioned deltas, full resync on mismatch Deltas with a version check
    Draft saving Every keystroke Debounce, newest revision wins Debounce, plus an immediate save on leaving
    Bulk "all" Ids on screen Every match of a query Ids on screen; a query needs an explicit count
    Body rendering Inject HTML into the page Sandboxed iframe Sandboxed iframe

    In practice: an inbox where archived mail kept coming back

    NOTE

    This is a realistic scenario, not a case history. It is a composite built from common production patterns. It describes no specific company or product, and every number in it is an illustrative assumption.

    The situation

    A company builds a web inbox for its support team. Agents archive dozens of conversations in a row. Two complaints arrive: archived conversations reappear a few seconds later, and "I archived a reply thread and never saw the answer".

    Starting architecture

    Figure 6. Starting point: edit the list, then refetch it

    Starting architecture: the list is edited in place and a refetch replaces it a few seconds laterInbox list to Mail API (archive); Refetch to Inbox list (replaces list)Inbox list: edited in placeInbox listedited in placeMail API: action, then listMail APIaction, then listRefetch: every few secondsRefetchevery few secondsarchivereplaces list

    How to read this: the refetch can return before the server has applied the archive, and it replaces whatever the user did in between. Nothing marks which rows the user has changed.

    Options considered

    Option What it fixes What it costs Risk
    Pause refetching while actions are pending Reappearing rows Cheap New mail is delayed while the user works
    Merge refetched rows and skip ids the user touched Reappearing rows A set of "touched" ids Touched ids must expire, or mail is hidden for ever
    Base plus ordered pending operations, deltas by version Both symptoms A small core with tests The server must expose versions and deltas

    The decision

    Field Decision record
    Context Refetches overwrite the user's actions; an archive hides mail the user has not seen.
    Decision Keep server state and pending operations separate, show the first with the second laid over it, hold archives for a short undo window, and skip threads whose newest message is newer than the one the user acted on.
    Consequences, good Actions survive refetches and deltas; a rejection puts back exactly one operation; new replies are never hidden.
    Consequences, bad The client holds two sets of state and a rule to explain; the server needs versions and a delta call.
    Revisit when Multi-device undo is needed (a held operation then needs a home on the server).

    Rollout and verification

    1. Replay recorded event sequences into the core in tests: action, delta, reject, resync, in every order that has been seen.
    2. Ship the version and delta call first, with the old refetch as the fallback.
    3. Watch three numbers: rejected operations per hour, full resyncs per hour (a spike means deltas are failing) and operations dropped as stale.

    The 2 a.m. failure

    After a server upgrade, every delta carries a from version the clients have never seen, because the version format changed. Every client asks for a full resync at once, and the list endpoint is overloaded (illustrative).

    First three checks: (1) are resync requests rising; (2) do the from versions in deltas match the to of the previous one; (3) did the server change the version format. Mitigation: spread the resync with a random delay on the client and let the server answer with the delta for the last known version when it still can. Follow-up: treat the version as opaque on the client, add a test for a format change, and rate-limit the resync per client.

    The other side of this topic

    On the back end, the same product is storage, indexing, delivery and a change log that can answer "what changed since version X". Mail delivery, spam filtering and mailbox storage have their own case studies; the client's design above is only as good as the server's promise about versions and idempotent operations. See Idempotency Keys and Safe Retries for the retry side.

    Architect's notes

    • Make the server's contract explicit. Versions, deltas since a version, an error that means "I cannot compute that" and idempotent operations are what the client depends on.
    • Never mutate the server copy for an unconfirmed action. The overlay is what makes undo, reject and resync cheap.
    • Make "stale" a rule, not an accident. Decide what a pending action does when the thread changed; the date check is one answer.
    • Test orders. The bugs live in sequences such as undo after send, reject before a later confirm, delta before resync, answer for an old revision.
    • Keep the core free of clocks. Pass time as an input and the undo window, debounce and retry delay become plain tests.

    Common mistakes

    • Restoring a snapshot on failure, which discards later actions.
    • Refetching the list on a timer and overwriting what the user just did.
    • Applying an action to a thread that received a reply the user has not seen.
    • Keeping selected ids that left the view.
    • Marking a draft clean on any save answer, not just the newest revision's.
    • Saving on every keystroke, or not saving at all when the page is hidden.
    • Injecting a message body into the app's DOM.

    Key takeaways

    • Draw base with pending operations laid over it; confirm folds an operation in, reject removes just that one.
    • Hold destructive actions for a short window so undo costs nothing.
    • Leave alone any thread that got a newer message since the user acted.
    • Range selection works on the visible order; prune the selection after every change.
    • A delta applies only on the version it was computed from; otherwise resync once.
    • A draft is clean only when the newest revision was acknowledged.

    Practice exercises

    1. Label operation. Add a label operation with a name and write the test that a rejected label leaves other pending operations alone.
    2. Query-wide bulk. Design the event and effect for "archive everything matching this search", including the count the user must confirm.
    3. Persist the overlay. Save ops and the draft to storage and restore them; decide what to do with a held operation whose window passed while the tab was closed.
    4. Break the rule. Remove the debounce check and write the test that shows the number of save requests for a burst of typing.
    5. Accessibility pass. Write the announcements for archive, undo and a failed save, and decide which are polite and which assertive.

    Official documentation

    Ask about this article

    Get answers grounded in this post. AI-generated — based on this article, and may be imperfect.

    Scaled AI Weekly

    Enjoyed this? Get more like it every Monday.

    Real architecture decisions, LLMOps patterns that survive production, and engineering leadership advice — from 12+ years of building at enterprise scale. Free. No spam. Unsubscribe anytime.

    Get new articles by email

    Free. We email a confirmation link first, and you can unsubscribe from any email.

    Join engineers building production AI systems

    Comments