From cc5498b8fa4ac8b949426883b5d6370701b83b67 Mon Sep 17 00:00:00 2001 From: Sachin Rajyaguru Date: Thu, 14 Aug 2025 15:55:56 +0530 Subject: [PATCH] Update interactionmanager.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When it’s good to use / When not to use ++ Rule of Thumb --- docs/interactionmanager.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/docs/interactionmanager.md b/docs/interactionmanager.md index f9265e7db16..21a2849e45f 100644 --- a/docs/interactionmanager.md +++ b/docs/interactionmanager.md @@ -15,6 +15,41 @@ InteractionManager.runAfterInteractions(() => { }); ``` +--- + +`InteractionManager` is great for certain cases, but if you use it everywhere you might make your app **feel slow or unresponsive**. + +--- + +### ✅ When it’s *good* to use: + +* **Heavy JS work that isn’t urgent** + e.g., processing a large API response, sorting a big list, parsing JSON, etc. +* **Tasks after screen transitions** + e.g., preload non-critical data only after navigation animations finish. +* **Low-priority UI updates** + e.g., updating analytics, caching, saving drafts. + +--- + +### ❌ When *not* to use: + +* **Urgent actions that must happen immediately** + e.g., validation feedback after pressing “Submit,” updating a counter in real-time. +* **User input response** + Delaying UI reaction to touches will make the app feel laggy. +* **Short tasks (<1–2 ms)** + The delay from waiting for animations might be longer than the task itself. + +--- + +### 🔍 Rule of Thumb: + +> If the task can wait **a few hundred ms** without hurting the user experience, `InteractionManager` is your friend. +> If the task is essential for immediate feedback, run it right away. + +--- + Compare this to other scheduling alternatives: - `requestAnimationFrame()` for code that animates a view over time.