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

Function insertAfter

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

insertMethod · 0.65

Tested by

no test coverage detected