Optimistic UI and Skeleton Screens: Making Web Apps Feel Instant

Optimistic UI and Skeleton Screens: Making Web Apps Feel Instant — cover image

Speed Is Partly a Feeling

Two web apps can have the same server response time and feel completely different to use. In the first, you tap a button, a spinner appears, the screen freezes for a moment, and then the result shows up. In the second, the result appears the instant you tap, and any loading that does happen looks like the page gently filling in. The second app is not faster in a benchmark. It simply respects the user's attention.

This difference is called perceived performance, and for everyday products it often matters as much as measured performance. Users do not carry a stopwatch. They notice whether the interface responds to them, whether it jumps around while loading and whether they are left staring at a blank area with no idea what is happening.

Two patterns do most of the work here. Optimistic UI handles the moment after a user action. Skeleton screens handle the moment before content arrives. This guide explains both, shows where each one fits, and walks through how to implement them without creating new bugs.

The Two Patterns Explained

Optimistic UI

With an optimistic update, the interface behaves as if the server has already said yes. When a user ticks a task as done, the task shows as done immediately. The request travels to the server in the background. In the common case it succeeds and nothing more needs to happen. In the rare case it fails, the app restores the earlier state and explains why.

The reasoning is simple. For most routine actions in a healthy system, success is by far the most likely outcome. Making every user wait on every action to protect against an uncommon failure is a poor trade.

Skeleton screens

A skeleton screen is a lightweight placeholder that mirrors the layout of the content being loaded: grey blocks where the avatar, headline, paragraph lines and cards will be. When the data arrives, the real content replaces the placeholders in the same positions. The user sees structure straight away and the page does not jump.

Skeletons are different from empty states that guide new users toward their first action. A skeleton says "content is on its way". An empty state says "there is nothing here yet, and here is what to do about it". Mixing them up is a common source of confusion.

A Real-World Example: A Task Board on a Slow Connection

Take an illustrative scenario. A small logistics company uses an internal task board. Supervisors on the warehouse floor use it on tablets over a patchy Wi-Fi connection, where a request might typically take a second or two to complete.

Before. A supervisor drags a card from "Packing" to "Dispatched". The card snaps back to its original column and a spinner covers the board. After a pause the board reloads with the card in the new column. During the pause the supervisor cannot do anything else. When they need to move ten cards in a row, the pauses add up and the tool feels like it is fighting them. Some start keeping notes on paper and updating the board later, which defeats the purpose.

After. The card stays where the supervisor dropped it. A tiny sync indicator appears on the card for a moment and disappears. The supervisor moves the next card straight away. On the occasional failure, for instance because another supervisor had already archived that order, the card slides back and a short message reads "Could not move order 1042. It was archived by another user." Opening the board for the first time in the morning shows column outlines with placeholder cards, which fill in as data arrives.

Nothing on the server changed in this example. The requests take just as long as before. What changed is that the interface stopped making the user wait for information they did not need.

The goal is not to hide the network. The goal is to stop making the user wait for the network when the outcome is almost certain.

Step-by-Step: Implementing These Patterns Safely

  1. Classify your actions by risk. List the actions users perform and sort them into three groups. Low-risk and reversible actions (toggling, renaming, reordering, liking, marking as read) are good candidates for optimistic updates. Medium-risk actions (creating records, editing shared data) can be optimistic with care. High-risk or irreversible actions (payments, bookings against limited stock, external emails, permanent deletion) should wait for server confirmation.
  2. Snapshot the state before changing it. Before applying an optimistic update, keep a copy of the affected data. This snapshot is what you restore if the request fails. Most modern data-fetching libraries offer a hook for this, but the idea is the same in any stack.
  3. Apply the update locally and send the request. Update the local cache or state so the interface reflects the change immediately. For newly created items, generate a temporary client-side ID and mark the item as pending so it can be reconciled later.
  4. Make the request safe to retry. Networks drop responses even when the server has processed the request. Send a unique key with each mutation so the server can recognise a repeat and avoid applying it twice. Without this, a retry after a timeout can create duplicate records.
  5. Reconcile with the server response. When the response arrives, replace temporary IDs with real ones and accept the server's version of fields it controls, such as timestamps or computed totals. The server remains the source of truth. The optimistic state is only a prediction.
  6. Roll back visibly on failure. Restore the snapshot, explain the failure in plain language and offer a retry if appropriate. Preserve anything the user typed. A silent rollback is worse than no optimism at all, because the user walks away believing the change was saved.
  7. Handle rapid and concurrent changes. If a user toggles the same item several times quickly, make sure a late response from an earlier request does not overwrite a newer state. Cancel or ignore outdated responses. For data edited by several people at once, decide how conflicts are resolved and consider live updates, as covered in our comparison of WebSockets, SSE and polling for real-time web apps.
  8. Build skeletons that match the real layout. Create placeholder versions of your main components with the same dimensions as the loaded content. Reserve space for images. The closer the match, the less the page shifts when data arrives.
  9. Add timing rules. If data usually arrives very quickly, showing a skeleton for a split second creates a distracting flash. A common approach is to delay the skeleton briefly so that fast responses skip it altogether, and to keep it visible for a minimum time once shown. If loading takes unusually long, switch to a message that acknowledges the delay and offers a retry.
  10. Test on bad networks. Use browser throttling to simulate slow and failing connections. Force errors on purpose. Most bugs in these patterns only appear when requests are slow, out of order or rejected, which are conditions developers on fast office connections seldom see.

Where Each Pattern Fits

Good uses of optimistic updates

Where to wait for the server

For this second group, good feedback still matters. Disable the button after the first click, show progress on the button itself and keep the rest of the page usable where possible.

Good uses of skeleton screens

Long tables bring their own loading questions, which we cover in our guide to data tables, pagination and virtual scrolling.

Mistakes That Undermine the Effect

Key Benefits

Pairing Perceived Speed With Real Speed

These patterns work best on top of a healthy performance baseline. Keep an eye on bundle size, caching and query speed, and guard them with automated checks such as those described in our guide to performance budgets for web apps. Perceived speed and measured speed are partners. One without the other tends to show.

On projects delivered through our web development services, we treat loading and pending states as part of the design from the first sprint, not as something to tidy up before launch. Every screen has an answer to three questions: what does the user see while it loads, what do they see the moment they act, and what do they see when something goes wrong.

Conclusion

Users judge a web app by how it responds to them. Optimistic UI removes unnecessary waiting after routine actions. Skeleton screens replace blank waiting with visible structure. Both are modest in engineering effort compared with the difference they make, provided they are applied with clear rules: be optimistic only where failure is rare and reversible, always keep the server as the source of truth, and never hide a failure from the user.

A sensible first step is to pick the three actions your users perform most often and the three screens they open most often. Apply optimistic updates to the first group where the risk is low, add well-matched skeletons to the second, and test both on a throttled connection. That small investment is usually enough for users to describe the product as fast.

Frequently Asked Questions

What is an optimistic UI update?
An optimistic update changes the interface immediately when the user acts, before the server has confirmed the change. The app assumes the request will succeed, shows the result at once, and quietly reconciles with the server response. If the request fails, the interface rolls back and tells the user what happened.
When should I avoid optimistic updates?
Avoid them for actions that are hard to reverse or have real-world consequences, such as payments, bookings with limited stock, sending messages to external parties or deleting data permanently. In these cases the user needs certainty, so a clear pending state followed by a confirmed result is the safer design.
Are skeleton screens better than spinners?
For content with a predictable layout, usually yes. A skeleton shows the shape of the page that is about to appear, which reduces layout shift and gives the user a sense of progress. For short, unpredictable waits or small inline actions, a simple spinner or button state is still perfectly reasonable.
Do these patterns make the app actually faster?
No. They change how the wait is experienced, not how long the server takes. They work best alongside real performance work such as caching, smaller bundles and faster queries. Used alone to hide a slow backend, they eventually frustrate users because the confirmed state still arrives late.
How do I handle a failed optimistic update?
Restore the previous state, show a short message that explains the failure in plain language, and offer a retry where it makes sense. Keep the user's input so they do not have to type it again. Never fail silently, because the user will believe the action succeeded.