Skip to content

devtools ​

Connects a store to the Redux DevTools Extension for time-travel debugging.

Setup ​

Install the browser extension, then register the plugin. No namespace is required because the plugin adds no public methods or reducers:

ts
import { withPlugins } from "@kin-store/core";
import { devtools } from "@kin-store/plugins";

const store = withPlugins(0)
  .use({
    reducers: {
      increment: (state, n: number) => state + n,
    },
  })
  .use(devtools({ name: "counter" }));

Options ​

OptionTypeDefaultDescription
namestring"kin-store"Name shown in the extension's instance selector. Use a distinct name per store when registering multiple stores.

Production ​

The plugin is a no-op when the extension is absent, so it is safe to leave in production code. To eliminate it from the bundle entirely, use a ternary with your bundler's dev-mode flag:

ts
// Vite
.use(import.meta.env.DEV ? devtools() : {})

// webpack / Next.js
.use(process.env.NODE_ENV !== "production" ? devtools() : {})

The bundler replaces the flag with false, collapses the ternary to {}, and tree-shakes the devtools import.

State changes ​

Every state change is forwarded to the extension automatically.

SourceAction type sent
store.dispatch.name(...args)"name" with payload: args
store.set(...)"@@SET"

Supported panel actions ​

Panel actionEffect on the store
Jump to state / actionRestores the selected state snapshot
ResetRestores the initial state (at plugin activation)
CommitMakes the current state the new rollback baseline
RollbackRestores the last committed state
Import stateRestores the active state from the imported session

Toggle action and reorder action are not supported because they require replaying individual actions rather than restoring snapshots.

Released under the MIT License