-
Couldn't load subscription status.
- Fork 6
Open
Labels
Description
Expected Behavior
It should be possible to render the full graph after rendering a sub-graph without a significant performance penalty.
The following example is expected to work efficiently:
const blocks = [ /* blocks of the full graph */ ];
const connections = [ /* connections of the full graph */ ];
const graph = new Graph({ blocks, connections });
// Render a sub-graph
const { blocks: subGraphBlocks, connections: subGraphConnections } = getSubGraph(blocks, connections);
graph.setEntities({
blocks: subGraphBlocks,
connections: subGraphConnections,
});
// Re-render the full graph
// ⚠️ This step takes significantly longer due to recalculating styles
graph.setEntities({
blocks,
connections,
});In this scenario, re-rendering the full graph after rendering the sub-graph takes around 25 seconds for ~2000 blocks, whereas the initial render of the same graph takes less than 0.5 seconds.
Workaround
A temporary solution is to force a full re-render by assigning a new key to the GraphCanvas (or BlocksList) component each time setEntities is called.
draedful