UNPKG

@zedux/core

Version:

A high-level, declarative, composable form of Redux

25 lines (24 loc) 1.01 kB
import { ActionChain, HierarchyConfig } from '../types.js'; import { HierarchyNode } from '../utils/types.js'; /** * Delegates an action to a child store. * * Does nothing if the special `delegate` meta node is not present in the action * chain. * * This expects the `metaData` of the `delegate` meta node to be an array * containing a path of nodes describing the child store's location in the * parent store's current hierarchy descriptor. * * Delegated actions will not be handled by the parent store at all. */ export declare const delegate: (tree: HierarchyNode | undefined, action: ActionChain) => false | undefined; /** * Propagates a state change from a child store to a parent. * * Recursively finds the child store's node in the parent store's state tree and * re-creates all the nodes down that path. * * #immutability */ export declare const propagateChange: <State = any>(currentState: State, subStorePath: string[], newSubStoreState: any, hierarchyConfig: HierarchyConfig) => State;