<?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 probably 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 until the bug happens again.&lt;/p&gt;

&lt;p&gt;I wanted to see the whole chain instead. So I built &lt;strong&gt;Zustand DevTools&lt;/strong&gt;: a local-first Chrome DevTools panel for registered Zustand stores, action timelines and reproducible Trace Sessions.&lt;/p&gt;

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

&lt;p&gt;Zustand's appeal is that it's tiny and unopinionated. The trade-off is that a real app can leave you without a clear answer to: &lt;em&gt;what changed, when, and which action caused it?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What I wanted while debugging was deliberately specific:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a live view of each registered store,&lt;/li&gt;
&lt;li&gt;one timeline across several small stores,&lt;/li&gt;
&lt;li&gt;the exact changed path — &lt;code&gt;items[1].quantity: 1 → 2&lt;/code&gt; — instead of a wall of object output,&lt;/li&gt;
&lt;li&gt;and a safe way to inspect an earlier state without corrupting Dates, Maps, Sets or action functions.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;strong&gt;Stores + Timeline are free.&lt;/strong&gt; Add one wrapper to each store you want to inspect, open Chrome DevTools, and select the &lt;strong&gt;Zustand&lt;/strong&gt; panel. Registered stores appear with stable names and each named update becomes a timeline entry.&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;When the original in-memory snapshot is still available, you can jump to it safely by ID. Entries from before a reload, or from an imported trace, are visibly view-only; the extension never restores a lossy serialized copy into your live app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trace Sessions are Pro, with three complete previews included.&lt;/strong&gt; Start a trace, reproduce the bug and stop. You can then inspect path-level diffs, likely source call-sites, compare any two moments, add bookmarks and notes, and export a redacted session that a teammate can open view-only.&lt;/p&gt;

&lt;p&gt;That export is the workflow I wanted most: &lt;em&gt;open step 4 and you can see exactly where the total diverges&lt;/em&gt; is much more useful than another paragraph in Slack.&lt;/p&gt;

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

&lt;p&gt;Install the bridge and wrap the stores you want to inspect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;zustand-devtools-bridge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&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;state&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="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;Give each store a stable name and the Stores + Timeline views become accurate. A separate zero-setup &lt;strong&gt;Component Hooks (experimental)&lt;/strong&gt; view can help with a quick look, but it is honestly labelled: React hook values are not guaranteed to be Zustand state.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two design decisions I care about
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It chains the React DevTools hook instead of replacing it.&lt;/strong&gt; React DevTools can keep working next to it, whichever extension loads first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Application state stays on your machine.&lt;/strong&gt; There is no analytics, telemetry or developer server. Optional Pro activation sends only the entered licence key, the public product ID and Gumroad's use-count flag to Gumroad after a clear disclosure and consent; it never sends state, traces, URLs or source paths.&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 do not trust their output by default. I own the architecture, naming, test strategy and final review. The current release passes &lt;strong&gt;100 automated tests&lt;/strong&gt;, including Zustand 4 and 5 type checks, malformed message limits, import validation, licence revocation and the five-profile activation boundary.&lt;/p&gt;

&lt;p&gt;After I thought the tool was finished, a dedicated review found three silent failures that the earlier green suite had missed. I fixed them and expanded the regression coverage. A debugging tool that is subtly wrong is worse than no debugging tool at all.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chrome Web Store:&lt;/strong&gt; &lt;a href="https://chromewebstore.google.com/detail/zustand-devtools/flobjdlebndfbpojaepdgnpgflfbelmj" rel="noopener noreferrer"&gt;https://chromewebstore.google.com/detail/zustand-devtools/flobjdlebndfbpojaepdgnpgflfbelmj&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bridge on npm:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/zustand-devtools-bridge" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/zustand-devtools-bridge&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Source and setup:&lt;/strong&gt; &lt;a href="https://github.com/KubaOpoczka/zustand-devtools" rel="noopener noreferrer"&gt;https://github.com/KubaOpoczka/zustand-devtools&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interactive product demo:&lt;/strong&gt; &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;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pro:&lt;/strong&gt; €9.99 once, three full previews free, up to five Chrome profile/browser activations, and a 30-day refund: &lt;a href="https://opoczka.gumroad.com/l/zustand-devtools-pro" rel="noopener noreferrer"&gt;https://opoczka.gumroad.com/l/zustand-devtools-pro&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you use Zustand and React, I would genuinely like one kind of feedback: &lt;strong&gt;what did you try to inspect that the panel could not explain?&lt;/strong&gt; That is the shortest path to making it more useful.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;P.S. — this is my first DEV post. Corrections, implementation questions and honest product feedback are all welcome.&lt;/em&gt;&lt;/p&gt;

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