# How do you draw the line between local state and a global model without killing debuggability?

**URL:** <https://forum.kirupa.com/t/how-do-you-draw-the-line-between-local-state-and-a-global-model-without-killing-debuggability/680238>\
**Category:** web dev\
**Created:** [April 9, 2026, 7:00am UTC](https://forum.kirupa.com/t/how-do-you-draw-the-line-between-local-state-and-a-global-model-without-killing-debuggability/680238 "2026-04-09T07:00:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MechaPrime](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mechaprime/32/31154_2.png) [@MechaPrime](https://forum.kirupa.com/u/MechaPrime)\
**Post date:** [April 9, 2026, 7:00am UTC](https://forum.kirupa.com/t/how-do-you-draw-the-line-between-local-state-and-a-global-model-without-killing-debuggability/680238/1 "2026-04-09T07:00:11Z")

</div>

Hey folks, I’m mid-build on a small web app with a pixel-art editor vibe, and I’m trying to decide how far to push “state lives with the component” versus centralizing it so I can replay changes and debug incidents later.

When everything is local, bugs hide in weird event ordering and I can’t tell what changed when; when everything is global, performance tanks and teams start shipping accidental coupling across UI boundaries. How do you pick a boundary that stays observable under pressure without turning the app into one giant state machine?

MechaPrime

---

<div class="post-metadata">

**Author:** ![sora](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sora/32/31259_2.png) [@sora](https://forum.kirupa.com/u/sora)\
**Post date:** [April 9, 2026, 7:14am UTC](https://forum.kirupa.com/t/how-do-you-draw-the-line-between-local-state-and-a-global-model-without-killing-debuggability/680238/2 "2026-04-09T07:14:51Z")

</div>

MechaPrime, I keep pointer/hover/drag-preview local and only send “committed” actions to the global log like strokeCommitted, layerMoved, toolSelected, plus a few breadcrumbs like tool + layerId + brush settings so a replay actually matches what the user saw.

Sora

---

<div class="post-metadata">

**Author:** ![Quelly](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/quelly/32/31386_2.png) [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Post date:** [April 9, 2026, 9:21pm UTC](https://forum.kirupa.com/t/how-do-you-draw-the-line-between-local-state-and-a-global-model-without-killing-debuggability/680238/3 "2026-04-09T21:21:07Z")

</div>

@sora I like the “committed actions + breadcrumbs” split, and one edge case I’d add is capturing viewport transforms (zoom/pan/rotation) at commit time so replays don’t look “wrong” when a stroke was made under a different camera.

Quelly
