DevTools & time travel
Inspect events and restore state with the Redux DevTools extension. Treat time travel as state inspection with explicit limits.
Opt in, per store
Add devtools(options) to the enhancer list. instanceId is required by Solux’s DevToolsOptions; choose a distinct ID for each live store and use name for a readable connection label. The current implementation is safe when window or the browser extension is absent, including SSR.
import { configureStore, devtools } from "@carere/solux";
// rootSlice is fresh for this scope. Use a distinct instanceId per live store.
const store = configureStore({
rootSlice,
enhancers: [devtools({ instanceId: "chart-A", name: "Chart A" })],
});
// When the owning scope ends (unreleased):
store.dispose();What the commands actually do
State restoration uses Solid setState’s object update semantics; it is not a fresh store construction or a guaranteed whole-tree replacement. Keep a stable serializable state shape. DevTools messages are trusted input: this integration is not a runtime validation boundary.
| Command | Current repository behavior |
|---|---|
ACTION | Parse the JSON payload and dispatch it as an event. |
JUMP_TO_STATE / JUMP_TO_ACTION | Apply the supplied serialized state through Solid’s setState; handlers and epics are not replayed. |
ROLLBACK | Apply the serialized state supplied by the extension. |
RESET | Apply a fresh copy of the construction-time initial/preloaded baseline, then initialize the extension with current state. |
COMMIT | Initialize the extension with the current state. Does not change the construction RESET baseline. |
IMPORT_STATE | Use the last computed state and send a detached lifted-state copy to the extension. Empty computedStates is ignored. |
TOGGLE_ACTION / LOCK_CHANGES | Not implemented. |
New guarantees beyond 4.0.1
- SSR and extension-absent safety: the enhancer can return the store without connecting.
- Detached initial, event, and imported snapshots: later live mutations do not rewrite earlier snapshots sent to DevTools.
- A detached construction baseline for RESET, including preloadedState; COMMIT does not replace that baseline.
- Idempotent store disposal and per-connection cleanup; disposing chart A does not call the extension’s global disconnect or disconnect chart B.
- Callbacks delivered after disposal are ignored, including late messages during connection setup.
State travel is not effect replay
Restoring state does not replay the original events through handlers, deterministically rerun side effects, cancel epics, undo requests, or recreate chart handles. ACTION dispatch can run normal effects; JUMP state restoration follows a different path.
Keep DOM nodes, chart instances, functions, subscriptions, and cleanup resources outside serializable state. Create fresh live state for independent stores; DevTools cloning alone does not provide store isolation.