commit 8bb8050b0cc6124163113f513acb82d24c2278fd
parent 753c1f3ab968c3e119eed5aa3fa687430acccc04
Author: alltheseas <alltheseas@users.noreply.github.com>
Date: Fri, 2 Jan 2026 17:40:15 -0600
docs: add coding pattern for per-frame UI constraints
Add pattern #15: Never block the render loop. The UI runs every frame
so heavy work must be offloaded to JobPool or tokio::spawn, with
results polled via Promise::ready().
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
@@ -118,6 +118,7 @@ This document captures the current architecture, coding conventions, and design
12. Run **cargo fmt, cargo clippy, cargo test**.
13. **Do not vendor code**. In cargo.toml replace the existing url with the fork that includes the new code. If vendoring is absolutely necessary you must present the case why no other options are feasible.
14. **Avoid Mutexes** — prefer `poll_promise::Promise` for async results, `Rc<RefCell<>>` for single-threaded interior mutability, or `tokio::sync::RwLock` when cross-thread sharing is truly necessary. Mutexes can cause UI stalls if held across frames.
+15. **Per-frame UI constraints** — the UI runs every frame; never block the render loop. Use `Promise::ready()` for non-blocking result checks. Offload CPU-heavy work to `JobPool` or `tokio::spawn()`, returning results via channels or Promises.