Redux DevTools Integration
Inglorious Web includes first-class support for the Redux DevTools Extension, giving you powerful debugging capabilities.
Setup
1. Install Redux DevTools Extension
Browser extensions:
2. Create Middleware
javascript
import { createDevtools } from "@inglorious/web"
export const devtools = createDevtools()
1
2
3
2
3
3. Pass to Store
javascript
import { createStore } from "@inglorious/web"
import { devtools } from "./devtools"
const store = createStore({
types,
entities,
middlewares: [devtools.middleware],
})
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Features
Event Timeline
Every event you dispatch appears in the DevTools timeline:
javascript
// Dispatch event
api.notify("#counter:increment", 5)
// Shows up in DevTools as:
// Action: #counter:increment
// Payload: { value: 5 }
// Previous State: { count: 0 }
// New State: { count: 5 }
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Time Travel
Rewind and replay events:
- Click any event in the timeline
- App jumps to that state
- Make changes, step back/forward
Perfect for debugging complex state flows!
Action Filtering
You can filter which events appear in the DevTools in three independent ways; these can be combined:
blacklist/whitelist— simple lists of event types to exclude or include.filter— a custom predicate function that receives the event and config and returnstrueto log.
Examples:
- Use a blacklist to hide noisy internal events:
javascript
const devtools = createDevtools({
filters: {
updateMode: "auto",
blacklist: ["#internal:heartbeat", "#metrics:tick"],
},
})
1
2
3
4
5
6
2
3
4
5
6
- Use a whitelist to show only specific event types:
javascript
const devtools = createDevtools({
filters: {
whitelist: ["#user:login", "#user:logout", "#router:navigate"],
},
})
1
2
3
4
5
2
3
4
5
- Use a custom
filterpredicate for arbitrary logic (for example, only log events for the current user):
javascript
const devtools = createDevtools({
filters: {
filter: (event) => event.payload && event.payload.userId === currentUserId,
},
})
1
2
3
4
5
2
3
4
5
- Combine all three rules — blacklist, whitelist and predicate — they are ANDed together (and
updateModemust be"auto"):
javascript
const devtools = createDevtools({
filters: {
updateMode: "auto", // this is the default, you can omit it
blacklist: ["#internal:heartbeat"],
whitelist: ["#user:login", "#user:logout", "#router:navigate"],
filter: (event) => event.payload && event.payload.userId === currentUserId,
},
})
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Notes:
- If both
blacklistandwhitelistare empty, all events pass that stage. Ifwhitelistis non-empty only listed events pass. - A
filterpredicate gives you full flexibility to inspect payloads or timestamps, and runs after blacklist/whitelist checks. - Because the filter pipeline checks
updateModefirst, settingupdateMode: "manual"is an efficient way to disable DevTools logging entirely.
State Inspection
View entire store state at any point:
- Expand/collapse entities
- Search for properties
- Copy state as JSON
Dispatch Custom Events
Manually trigger events for testing:
- Open DevTools console
- Type:
$r.store.notify('#counter:increment') - See state update instantly
Advanced Configuration
Custom Middleware Name
javascript
const devtools = createDevtools({
name: "My App",
features: {
pause: true, // Pause between events
lock: true, // Lock state to prevent changes
persist: true, // Remember history
export: true, // Export state
import: "custom", // Custom import behavior
jump: true, // Time travel
skip: true, // Skip events
reorder: true, // Reorder events
dispatch: true, // Dispatch events
test: true, // Testing support
},
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Action Sanitizer
Hide sensitive data:
javascript
const devtools = createDevtools({
actionSanitizer: (action) => ({
...action,
payload: action.payload.type === "login" ? "***" : action.payload,
}),
})
1
2
3
4
5
6
2
3
4
5
6
State Sanitizer
Hide sensitive state:
javascript
const devtools = createDevtools({
stateSanitizer: (state) => ({
...state,
user: {
...state.user,
password: "***",
},
}),
})
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Debugging Workflows
Debug Event Sequence
- Open DevTools
- Perform user actions in your app
- See event timeline in DevTools
- Click events to see state at each step
- Identify the problematic event
Debug State Mutations
- Find the event that caused wrong state
- Click it in timeline
- See previous and new state
- Compare to find what changed
Replay Issues
- Export problematic event sequence
- Import in another browser/device
- App replays same actions
- Exact same bug occurs (reproducible!)
Step Through Logic
- Dispatch event from console
- Watch state update in DevTools
- Check entity state
- Verify render updated
In Production
For production builds, disable DevTools:
javascript
import { createDevtools } from "@inglorious/web"
const middlewares = []
if (import.meta.env.DEV) {
middlewares.push(createDevtools().middleware)
}
const store = createStore({
types,
entities,
middlewares,
})
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Or use a feature flag:
javascript
const middlewares = window.__ENABLE_DEVTOOLS__
? [createDevtools().middleware]
: []
1
2
3
2
3
Tips
✅ Use DevTools for:
- Debugging complex state flows
- Understanding event sequences
- Testing edge cases
- Reproducing user-reported issues
- Learning how your app works
❌ Don't use DevTools to:
- Store/retrieve state permanently
- Bypass normal event flow
- Skip event handlers
Next Steps
- Testing — Complement DevTools with automated tests
- Error Handling — Debug errors with DevTools
Happy debugging! 🐛
Inglorious Web