Skip to content

Redux Toolkit

@input-actions/redux wraps a Redux Toolkit store. Every action you dispatch flows through a single Redux slice as inputActions/executeAction, so the Redux DevTools browser extension lights up — with the original action tuple visible as the payload.

Terminal window
pnpm add @input-actions/redux @reduxjs/toolkit
import { createReduxStoreSync } from '@input-actions/redux';
export const store = createReduxStoreSync({
user: { name: '' },
count: 0,
_async: {},
});

@reduxjs/toolkit is a static import, so creating the store is synchronous. It works at module scope and during SSR. createReduxStore and ensureReduxToolkitLoaded still exist for code that already awaits them, and they resolve immediately.

Hand the store to the provider exactly like the built-in SimpleStore:

import { StoreProvider } from '@input-actions/core';
import { store } from './store';
<StoreProvider store={store}>
<App />
</StoreProvider>

The adapter calls configureStore({ reducer, devTools: process.env.NODE_ENV !== 'production' }) under the hood. With the Redux DevTools browser extension installed, you get:

  • Time-travel debugging — step backwards and forwards through every dispatched action. State is replayed by re-running the input-actions executor for each step.
  • Action history with payloads — every entry shows inputActions/executeAction with the literal action tuple (['action/save', ['user', 'name'], 'Alex']) as the payload. Searchable, copy-paste-able.
  • Diff view — see exactly which paths in state changed between two actions.
  • State export/import — pin a state snapshot, share it in a bug report.

This works because every input-actions dispatch funnels through one Redux action type with the tuple as the payload. The tuple-as-data design means the entire description of the state change is visible in the DevTools timeline — not opaque thunk names.

The adapter doesn’t expose a public getter for the underlying Redux store today (the field is private). If you need extra Redux middleware (logger, sentry, custom), the path is to extend the adapter or fork the small setup in packages/redux/src/index.ts. The configurator there is ~25 lines.

For most apps, DevTools alone is the win.

Every async strategy (prevent, cancel, queue, debounce, allow) works unchanged. The adapter’s dispatch warns and short-circuits when it sees an action/async* directly — those go through the executor in StoreProvider, which then dispatches the sync follow-ups (['action/save', ['_async', opId, 'status'], 'success'], etc.) into Redux normally. From the DevTools perspective: you see one entry per state mutation, which is exactly what you want.

The redux example wires this all together — open it, open Redux DevTools, click around. Every state change is a tuple you can read.