Prompt(1/3)
Prompt
Review how my product handles waiting, and decide for each wait which loading state fits: nothing, a spinner, a skeleton, progress, an optimistic change, or an AI answer written as it arrives. Then, if I want it, change them along the lines below. This is about judgment first: diagnose and recommend, and change only what I approve.
This is a change to my product, not a demo. Work inside my code, on my stack, with my components, tokens, motion values and copy style. Do not add a dependency, a data library or a new visual pattern without asking. Every value below is a default to start from.
0. Read the product first
- Find every place a person waits: page and route loads, lists and tables, search and filters, buttons that call the server (save, send, sync, delete), uploads, imports and exports, background jobs, and AI calls.
- For each one, note: what starts it; how long it usually takes (measure it, or estimate from the call: cached, one request, several, a job); what is shown meanwhile (a spinner, a skeleton, nothing, a blocking overlay); whether the layout moves when the data arrives; whether the person can keep working; what happens when it fails; and whether it can be cancelled.
- Find the shared pieces: the spinner, skeleton and progress components, the data layer (a fetch wrapper, React Query, SWR, Apollo, a store), and any global loading bar or overlay.
- Tell me in a few lines what you found before going on.
1. The kinds of waiting
a. Under 300ms: show no separate loader (no spinner, skeleton or bar): one that appears and goes in under 300ms reads as a flicker. The one exception is a button whose own icon already means the action, which turns from the press (b). The result is the feedback: when it shows where the person is looking, nothing more is needed; when it doesn't (a sync, a copy, a save off-screen), confirm it with a short toast.
b. A short wait for one action, length unknown (about 0.3 to 3s): show it where the person acted, with the label and the width unchanged. If the button's icon already means the action (sync, refresh), turn that icon from the press: at least one whole turn even when the answer is instant, and on until the answer lands, always stopping on a whole turn. Otherwise the icon becomes a spinner, started only after 300ms and kept at least 500ms. Block a second press while it runs, but never grey out the page. When it is done, the button goes back as it was and a short toast gives the result (Synced, 1 task updated): at the top centre, a few words, gone after about 3s.
c. Content whose layout is known (a page, a list, a card, a table): a skeleton.
- Show what does not depend on the data at once: the title, tabs, filters, column headers.
- After 300ms, draw skeleton shapes for the rest, at the real sizes and places: the same row height and avatar size, lines a little shorter than the text, their lengths varying a little.
- A light band crosses the whole list together, every 1.2s.
- When the data arrives, the real rows take the same places, top to bottom, each fading in over 200ms, 40ms apart. Nothing jumps. If fewer rows come back, the extra shapes fade out.
- Never put a lone spinner in the middle of an empty page instead.
d. Long work that can be counted (uploads, imports, exports, batch jobs, over about 3s): progress.
- Say what it is doing, how far (a count or a percentage, and a bar), and the time left once there is a second of data to estimate from; before that, "Estimating…".
- Show it in a notification at the top right when the work goes on while the person moves on (an import, an export, a batch job): it keeps the page free, stays on every page and is kept until handled. Work that only concerns one item can show in that item's place instead, at the same size, so nothing on the page moves.
- Keep the page usable and offer Cancel. If it can go on without the person, let it run in the background and tell them when it is done.
- Show it once the work has run 300 to 500ms; a job done sooner needs only the result.
- At the end it turns into the result in place, and opens it when clicked.
- Long work that cannot be counted: name the stage it is in (Connecting, Processing 3 files) rather than an endless spinner; after about 10s, say it is taking longer than usual and offer to keep it running in the background.
✨ 巧用等待状态,让产品响应更丝滑——《999 个小技巧,让你 Vibe 的产品更有质感》017
在实际运行的产品中,等待不可避免。如何把等待合理地告知用户,会影响用户的情绪和操作的流畅度,有时甚至应该先给出反馈,再根据结果更正。今天介绍几种常见的交互模式:
Spinner:按钮搭配 Toast,适合几秒内就能完成的操作,如刷新、同步。点击后按钮图标原地旋转,结束后用 Toast 告知结果,轻量,也不打断操作。
Skeleton:页面结构已知时,先显示骨架,再换成真实内容。用户能提前知道内容会出现在哪里,内容到达后原位替换,页面不跳动。常见于信息流、图表等内容面积较大的场景。
Progress:明确告知用户进度和最终结果,常见于上传、导入、诊断等耗时任务。可以用 Toast 或通知卡片呈现,也可以嵌在页面或表单中。
Optimistic:严格来说,这是一种策略而非模式。对于大概率成功、也容易退回的操作,先显示结果,再在后台保存;保存失败时,把改动退回原处,说明原因,并提供重试。
另外,300ms 以内的等待通常不显示单独的加载状态,否则它刚出现就消失,看起来像闪了一下。
附一条 Prompt(比较长,如果你需要):它会先找出你的产品里所有需要等待的地方,逐个判断该用哪种方式,列出表格由你决定;确认后,再按视频中的效果改造 ⬇️