// Reclaim unused storage after removing many elements
cy.compact(): thisReclaim unused storage after removing many elements. Existing element handles, listeners and drawing order are preserved.
Compaction normally happens automatically. Call this method to choose when its work occurs, for example after a bulk removal. It throws during a batch and defers with a warning while a GPU force layout is running.
Returns
thisExample
cy.remove(cy.getElementById('c'));cy.compact();console.log(cy.nodes().map(node => node.id())); // ['a', 'b']Also spelled cy.gc.