MCPcopy Create free account
hub / github.com/adobe/react-spectrum / insertAfter

Function insertAfter

packages/react-stately/src/data/useTreeData.ts:324–334  ·  view source on GitHub ↗
(key: Key, ...values: T[])

Source from the content-addressed store, hash-verified

322 this.insert(parentNode?.key ?? null, index, ...values);
323 },
324 insertAfter(key: Key, ...values: T[]): void {
325 let node = nodeMap.get(key);
326 if (!node) {
327 return;
328 }
329
330 let parentNode = nodeMap.get(node.parentKey!);
331 let nodes = parentNode ? parentNode.children : items;
332 let index = nodes!.indexOf(node);
333 this.insert(parentNode?.key ?? null, index + 1, ...values);
334 },
335 prepend(parentKey: Key | null, ...values: T[]) {
336 this.insert(parentKey, 0, ...values);
337 },

Callers

nothing calls this directly

Calls 1

insertMethod · 0.65

Tested by

no test coverage detected