- const files = await services.collectionService.files(node.value.portableDataHash);
- const data = getNodeDescendants('')(files).map(node => node.value);
-
- dispatch<any>(receiveTreePickerData<CollectionDirectory | CollectionFile>({
- id,
- pickerId,
- data,
- extractNodeData: value => ({
- id: value.id,
- status: TreeNodeStatus.LOADED,
- value,
- }),
- }));
+ const filesTree = await services.collectionService.files(node.value.portableDataHash);
+
+ dispatch(
+ treePickerActions.APPEND_TREE_PICKER_NODE_SUBTREE({
+ id,
+ pickerId,
+ subtree: mapTree(node => ({ ...node, status: TreeNodeStatus.LOADED }))(filesTree)
+ }));
+
+ dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id, pickerId }));