I'm using React Redux in my project, and I've been trying to get the drop down to work correctly. In onChange, onAction, onNodeToggle I'm calling redux actions, which essentially is just a function that passes the variables to a reducer that sets the state tree.
Here's the component definition:
<DropdownTreeSelect
data={this.props.state.tree}
onChange={(currentNode, selectedNodes) => {
this.props.actions.treeChange(currentNode, selectedNodes)
}}
onAction={({ action, node }) => {
this.props.actions.treeAction(action, node)
}}
onNodeToggle={currentNode => {
this.props.actions.treeNodeToggle(currentNode)
}}
placeholderText={'Select...'}
/>
Let's use the onChange event as an example. Here's the code for the treeChange action:
export const treeChange = (currentNode, selectedNodes) => {
return (dispatch, getState) => {
dispatch({
type: types.TREE_CHANGE,
payload: {
currentNode: currentNode,
selectedNodes: selectedNodes
}
})
}
}
The event fires correctly, the action dispatches correctly, the state tree is modified correctly, i.e. currentNode and selectedNode is passed along and the state is set as desired.
The problem is that the control itself is not updating, i.e. the checkboxes do not get selected, the nodes don't toggle at all. It appears that the "rest" of the function that's supposed to happen after the action is dispatched just doesn't happen. If I comment out actions inside the events, it works perfectly fine.
I might be missing something really obvious... Any help would be appreciated. Thanks!