function onSelect(state, { accessible, response: ancestry, error }) { if (error) { console.warn("Error fetching ancestry", accessible, error); return state; } const { path, expanded } = updateExpandedNodes(state.expanded, ancestry); const selected = TreeView.subPath(path, accessible.actorID); return Object.assign({}, state, { expanded, selected }); }
const path = ancestry.reduceRight((accPath, { accessible }) => { accPath = TreeView.subPath(accPath, accessible.actorID); expanded.add(accPath); return accPath; }, "");