get children on invalidation

Summary: When a node was invalidated, not only the node itself needs to be refetched, but also its children.

Reviewed By: jknoxville

Differential Revision: D14280318

fbshipit-source-id: a262a2c95347dc9bf72f83b6a9eba9d3f9badb5a
This commit is contained in:
Daniel Büchele
2019-03-04 02:03:02 -08:00
committed by Facebook Github Bot
parent b0551bb74e
commit 7d39c33fc4

View File

@@ -77,8 +77,17 @@ export default class Inspector extends Component<Props> {
this.props.client.subscribe(
this.call().INVALIDATE,
({nodes}: {nodes: Array<{id: ElementID}>}) => {
this.getNodes(nodes.map(n => n.id), {});
({
nodes,
}: {
nodes: Array<{id: ElementID, children: Array<ElementID>}>,
}) => {
this.getNodes(
nodes
.map(n => [n.id, ...(n.children || [])])
.reduce((acc, cv) => acc.concat(cv), []),
{},
);
},
);