@@ -59,7 +59,10 @@ final class Store<Namespace: StoreNamespace>: @unchecked Sendable {
5959
6060    /// Executor that processes actions through the pipeline.
6161    private  let  executor :  StoreExecutor < Namespace > 
62-     
62+ 
63+     /// Coordinator that can skip redundant actions before execution.
64+     private  let  coordinator :  StoreCoordinator < Namespace > 
65+ 
6366    /// Publisher that holds and emits the current state.
6467    private  let  stateSubject :  CurrentValueSubject < Namespace . State ,  Never > 
6568
@@ -81,20 +84,23 @@ final class Store<Namespace: StoreNamespace>: @unchecked Sendable {
8184    ///   - middleware: Array of middleware for side effects.
8285    ///   - logger: Logger for recording store operations.
8386    ///   - executor: Executor for processing the action pipeline.
87+     ///   - coordinator: Coordinator that validates actions before execution.
8488    init ( 
8589        identifier:  String , 
8690        initialState:  Namespace . State , 
8791        reducers:  [ Reducer < Namespace > ] , 
8892        middleware:  [ Middleware < Namespace > ] , 
8993        logger:  StoreLogger < Namespace > , 
90-         executor:  StoreExecutor < Namespace > 
94+         executor:  StoreExecutor < Namespace > , 
95+         coordinator:  StoreCoordinator < Namespace > 
9196    )  { 
9297        self . identifier =  identifier
9398        stateSubject =  . init( initialState) 
9499        self . reducers =  reducers
95100        self . middleware =  [ ] 
96101        self . logger =  logger
97102        self . executor =  executor
103+         self . coordinator =  coordinator
98104
99105        middleware. forEach  {  add ( $0)  } 
100106    } 
@@ -241,17 +247,17 @@ final class Store<Namespace: StoreNamespace>: @unchecked Sendable {
241247    ///     logger.error("Action failed: \(error)")
242248    /// }
243249    /// ```
244- 
250+     ///
251+     /// - Returns: A ``StoreTask`` that can be awaited or ignored for
252+     ///   fire-and-forget semantics.
245253    @discardableResult  
246-     /// - Returns: A ``StoreTask`` that can be awaited for completion
247-     ///   or ignored for fire-and-forget semantics.
248254    func  dispatch( 
249255        _ actions:  [ StoreActionBox < Namespace . Action > ] , 
250256        file:  StaticString  =  #file, 
251257        function:  StaticString  =  #function, 
252258        line:  UInt  =  #line
253259    )  ->  StoreTask < Namespace >  { 
254-         let  task  =  StoreTask ( executor:  executor) 
260+         let  task  =  StoreTask ( executor:  executor,  coordinator :  coordinator ) 
255261        processingQueue. addTaskOperation  {  [ weak self]  in 
256262            guard  let  self else  { 
257263                return 
@@ -272,9 +278,13 @@ final class Store<Namespace: StoreNamespace>: @unchecked Sendable {
272278        return  task
273279    } 
274280
281+     /// Dispatches a single boxed action asynchronously.
282+     ///
283+     /// Wraps the action in an array and forwards to
284+     /// ``dispatch(_:file:function:line:)``.
285+     ///
286+     /// - Returns: A ``StoreTask`` that can be awaited or ignored.
275287    @discardableResult  
276-     /// - Returns: A ``StoreTask`` that can be awaited for completion
277-     ///   or ignored for fire-and-forget semantics.
278288    func  dispatch( 
279289        _ action:  StoreActionBox < Namespace . Action > , 
280290        file:  StaticString  =  #file, 
@@ -289,9 +299,13 @@ final class Store<Namespace: StoreNamespace>: @unchecked Sendable {
289299        ) 
290300    } 
291301
302+     /// Dispatches multiple unboxed actions asynchronously.
303+     ///
304+     /// Actions are boxed automatically before being forwarded to
305+     /// ``dispatch(_:file:function:line:)``.
306+     ///
307+     /// - Returns: A ``StoreTask`` that can be awaited or ignored.
292308    @discardableResult  
293-     /// - Returns: A ``StoreTask`` that can be awaited for completion
294-     ///   or ignored for fire-and-forget semantics.
295309    func  dispatch( 
296310        _ actions:  [ Namespace . Action ] , 
297311        file:  StaticString  =  #file, 
@@ -306,9 +320,13 @@ final class Store<Namespace: StoreNamespace>: @unchecked Sendable {
306320        ) 
307321    } 
308322
323+     /// Dispatches a single unboxed action asynchronously.
324+     ///
325+     /// The action is boxed automatically and forwarded to
326+     /// ``dispatch(_:file:function:line:)``.
327+     ///
328+     /// - Returns: A ``StoreTask`` that can be awaited or ignored.
309329    @discardableResult  
310-     /// - Returns: A ``StoreTask`` that can be awaited for completion
311-     ///   or ignored for fire-and-forget semantics.
312330    func  dispatch( 
313331        _ action:  Namespace . Action , 
314332        file:  StaticString  =  #file, 
0 commit comments