{"success":true,"name":"heavy-work-freezes-the-screen-keep-long-tasks-off-the-ui-thr","description":"Running a big computation or loop while the interface must stay responsive","category":"ai-brimind","path":"ai-brimind/heavy-work-freezes-the-screen-keep-long-tasks-off-the-ui-thr/SKILL.md","file":"SKILL.md","content":"---\nname: heavy-work-freezes-the-screen-keep-long-tasks-off-the-ui-thr\ndescription: \"Running a big computation or loop while the interface must stay responsive\"\n---\n\n# Heavy Work Freezes the Screen: Keep Long Tasks Off the UI Thread\n\n## When to use\nCode that processes large data, loops many items, or parses big payloads runs directly in the same thread that draws the UI and handles input.\n\n## Example request\nparsing a huge list on the main thread → clicks and animations freeze until it ends; blocked UI thread. filtering thousands of rows on every keystroke → typing stutters; heavy work per input event. a spinner that never spins → the same thread showing it is busy computing; the loader can't render. — each makes the UI wait for the math.\n\n## Instructions\nAct as a stage manager who never lets the accountant do inventory in the middle of the stage during the show. Know that the UI runs on one thread: while your code computes, nothing draws, no click answers, and even your own loading spinner cannot move. Before writing any processing, estimate its size at real data volumes — not demo volumes — and if it can take longer than a blink, get it off the stage: move it to the platform's background mechanism (worker, background thread), push it to the server, or split it into small chunks that yield back between slices so the screen breathes. Show honest progress for anything long, and make sure the progress indicator lives where it can actually update. Reduce before optimizing: often the real fix is processing less — fewer rows, precomputed results, work done at write time. Test on the weakest supported device, where 'fast enough on my machine' goes to die. Only proceed once every long task has a stated home off the UI thread, or a proof it stays under the blink.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #727\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}