You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/handover/state-machine-development-guide.md
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -239,6 +239,51 @@ The codebase uses callbacks for decoupled component communication. The `redux::c
239
239
240
240
For detailed callback patterns and examples, see [Architecture Walkthrough](architecture-walkthrough.md#callbacks-pattern).
241
241
242
+
### Global State Access Pattern
243
+
244
+
When reducers need to access multiple parts of the global state or coordinate between different subsystems, use `into_dispatcher_and_state()` instead of `into_dispatcher()`.
245
+
246
+
**When to use `into_dispatcher_and_state()`:**
247
+
- Generating request IDs from other subsystems
248
+
- Reading configuration from other state machines
249
+
- Coordinating between multiple components
250
+
- Accessing peer information or network state
251
+
252
+
**Common use cases:**
253
+
```rust
254
+
// Getting request IDs from other subsystems
255
+
let (dispatcher, global_state) =state_context.into_dispatcher_and_state();
0 commit comments