MCPcopy Create free account
hub / github.com/Effect-TS/effect / removeAll

Function removeAll

packages/effect/src/ui/internal/kernel.ts:1458–1469  ·  view source on GitHub ↗
(inst: Instance, parent: unknown, olds: ReadonlyArray<Rec>)

Source from the content-addressed store, hash-verified

1456// A bound child's old placement may hold only a placeholder while its nodes await a move,
1457// and the container may hold nodes the renderer did not place. Clearing it would detach them.
1458const removeAll = (inst: Instance, parent: unknown, olds: ReadonlyArray<Rec>): void => {
1459 const host = inst.tree.host
1460 const from = boundReleases
1461 const nodes: Array<unknown> = []
1462 for (let index = 0; index < olds.length; index++) {
1463 release(inst, olds[index]!)
1464 nodesOf(olds[index]!, nodes)
1465 }
1466 if (host.clear === undefined || boundReleases !== from || !host.clear(parent, nodes.length)) {
1467 for (const node of nodes) host.remove(parent, node)
1468 }
1469}
1470
1471/** @internal */
1472export const nodesOf = (rec: Rec, out: Array<unknown>): Array<unknown> => {

Callers 2

patchElementFunction · 0.85
patchListFunction · 0.85

Calls 4

releaseFunction · 0.70
nodesOfFunction · 0.70
clearMethod · 0.65
removeMethod · 0.65

Tested by

no test coverage detected