<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kuba Opoczka</title>
    <description>The latest articles on DEV Community by Kuba Opoczka (@kuba_opoczka_a6fb453bac5f).</description>
    <link>https://dev.to/kuba_opoczka_a6fb453bac5f</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4064861%2F5046f31a-ebae-4625-b304-0633884c0185.png</url>
      <title>DEV Community: Kuba Opoczka</title>
      <link>https://dev.to/kuba_opoczka_a6fb453bac5f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kuba_opoczka_a6fb453bac5f"/>
    <language>en</language>
    <item>
      <title>I built a time-travel debugger for Zustand — and it caught three bugs I'd already shipped</title>
      <dc:creator>Kuba Opoczka</dc:creator>
      <pubDate>Wed, 05 Aug 2026 22:19:14 +0000</pubDate>
      <link>https://dev.to/kuba_opoczka_a6fb453bac5f/i-built-a-time-travel-debugger-for-zustand-and-it-caught-three-bugs-id-already-shipped-1cce</link>
      <guid>https://dev.to/kuba_opoczka_a6fb453bac5f/i-built-a-time-travel-debugger-for-zustand-and-it-caught-three-bugs-id-already-shipped-1cce</guid>
      <description>&lt;p&gt;If you use Zustand, you've had this moment: the UI is wrong, you &lt;em&gt;know&lt;/em&gt; a store changed when it shouldn't have, and now you're scattering &lt;code&gt;console.log&lt;/code&gt; calls and refreshing, trying to catch the one action that did it. State debugging is detective work — and Zustand, by design, is so minimal that it doesn't give you much to work with.&lt;/p&gt;

&lt;p&gt;I wanted to &lt;em&gt;see&lt;/em&gt; it instead. So I built &lt;strong&gt;Zustand DevTools&lt;/strong&gt;: a Chrome DevTools panel that records every state change in your app and lets you walk back through them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;Zustand's whole appeal is that it's tiny and unopinionated — no boilerplate, no context wrappers, no ceremony. The flip side is there's no built-in answer to &lt;em&gt;"what changed, when, and because of which action?"&lt;/em&gt; The Redux DevTools middleware exists, but it's Redux-shaped: action-centric, and awkward the moment you have several small stores instead of one big one.&lt;/p&gt;

&lt;p&gt;What I actually wanted while debugging was boring and specific:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a live view of each store's current state,&lt;/li&gt;
&lt;li&gt;a timeline of every change, labelled with the action name,&lt;/li&gt;
&lt;li&gt;the exact &lt;strong&gt;path&lt;/strong&gt; that changed (&lt;code&gt;items[1].quantity: 1 → 2&lt;/code&gt;), not a whole-object diff I have to eyeball,&lt;/li&gt;
&lt;li&gt;and the ability to jump back to any point and look around.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;Two parts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stores + Timeline (free).&lt;/strong&gt; Open DevTools, click the Zustand tab, and every registered store shows up live. Every &lt;code&gt;set()&lt;/code&gt; becomes a timeline entry with the action name and a path-level diff:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[cart] addItem    items[1].quantity: 1 → 2    total: 168 → 297
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click any entry to time-travel to that moment — safely, by ID, rather than by replaying a fragile sequence of actions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trace Sessions (Pro).&lt;/strong&gt; Record while you reproduce a bug, then inspect the recording: path-level diffs, the likely call-site of each change, compare any two entries, and export a redacted session a teammate can import and inspect &lt;strong&gt;view-only&lt;/strong&gt;. That export is the part I use most. &lt;em&gt;"Here's the recording — drag the playhead to step 4 and you'll see where the total goes wrong"&lt;/em&gt; beats a paragraph of Slack every single time.&lt;/p&gt;

&lt;h2&gt;
  
  
  How you wire it up
&lt;/h2&gt;

&lt;p&gt;One wrapper per store you want to inspect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;create&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;zustand&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;withDevtoolsBridge&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;zustand-devtools-bridge&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;useCartStore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nf"&gt;withDevtoolsBridge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[],&lt;/span&gt;
      &lt;span class="na"&gt;addItem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
        &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;addItem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="c1"&gt;// named in the log&lt;/span&gt;
    &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cart&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Register a store once with a stable name and you get an accurate live view of it from then on. (There's also a zero-setup experimental view that reads hooks directly for a quick look — it's clearly labelled, because it can't always tell Zustand state apart from other hooks.)&lt;/p&gt;

&lt;p&gt;Two design decisions I care about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It chains the DevTools hook instead of clobbering it.&lt;/strong&gt; The real React DevTools keeps working right next to it, whichever loads first. A debugging tool that breaks your &lt;em&gt;other&lt;/em&gt; debugging tools is worse than nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State never leaves your machine.&lt;/strong&gt; Data flows from the inspected page to your panel and nowhere else — no server, no analytics, no telemetry. Your app state is often the most sensitive thing on the page; it shouldn't phone home just so you can look at it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The honest part
&lt;/h2&gt;

&lt;p&gt;I build software by directing AI coding agents, and I don't trust their output by default. The architecture, the naming, the test strategy and the review are mine. There are &lt;strong&gt;96 automated tests across two major framework versions&lt;/strong&gt;, because a state tool that's subtly wrong is actively dangerous — you'd end up debugging the debugger.&lt;/p&gt;

&lt;p&gt;And to be straight: after I'd "finished," I did a dedicated review pass over my own code and found &lt;strong&gt;three silent failures a green test suite had missed&lt;/strong&gt;. I fixed them and kept the diffs. If a tool for catching bugs can't survive its own author looking hard at it, it hasn't earned your trust.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Free:&lt;/strong&gt; install the Stores + Timeline tools from the Chrome Web Store, add &lt;code&gt;zustand-devtools-bridge&lt;/code&gt; to your app, and wrap a store.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pro:&lt;/strong&gt; unlimited Trace Sessions for a &lt;strong&gt;€9.99 one-time&lt;/strong&gt; purchase — three full previews free, no subscription, up to 5 devices, 30-day refund.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 &lt;strong&gt;Try it: &lt;a href="https://kubaopoczka.github.io/zustand-devtools-site/" rel="noopener noreferrer"&gt;https://kubaopoczka.github.io/zustand-devtools-site/&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you use Zustand and React, I'd genuinely like to know where it falls short — what you tried to inspect that it couldn't show you. That's the feedback that makes it better.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;P.S. — I'm new here: this is my first dev.to post, and honestly still finding my feet sharing work out loud like this. If you've got tips for a newcomer (or thoughts on the tool itself), I'd genuinely love to hear them. 🙏&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>zustand</category>
    </item>
  </channel>
</rss>
