Async confirm dialog loading

From ai-shifu/ai-shifu · View interactive version

Async confirm dialog loading is an AI agent skill from the GitHub repository ai-shifu/ai-shifu. Use for Cook Web confirmation dialogs that trigger asynchronous restart, deletion, or restore requests. Prevent duplicate clicks, show loading state, and close the dialog only when the request completes.

How to use this skill

Skill file

异步确认弹窗请求态

核心规则

工作流

  1. 先确认异步动作是否已经在 store、query 或 service 层暴露了稳定的 pending 标记,例如 resettingLessonId、isLoading、mutation.isPending。
  2. 若已有请求态,优先直接把确认按钮、关闭能力和弹窗显隐绑定到这份状态,而不是新增一份容易漂移的本地 loading。
  3. 若用户可能连续点击确认按钮,在组件层补 single-flight 包装,确保首个异步请求未完成前后续点击直接返回。
  4. 对触发弹窗的同步入口按钮增加短时间防抖,避免双击造成重复埋点、重复打开或事件冒泡副作用;不要误以为 single-flight 能覆盖这类同步打开动作。
  5. 修改后重点验证“快速双击入口按钮”“快速连点确认按钮”“请求失败后弹窗是否仍保留并允许再次提交”三条路径。

验证要点

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.