MCPcopy Create free account
hub / github.com/experdot/pointer / batchUpdateTreeItems

Function batchUpdateTreeItems

src/renderer/src/utils/treeUtils.ts:137–148  ·  view source on GitHub ↗
(
  tree: ConfigTree<T>,
  updates: Array<{ id: string; changes: Partial<T> }>
)

Source from the content-addressed store, hash-verified

135}
136
137export function batchUpdateTreeItems<T extends ConfigItemBase>(
138 tree: ConfigTree<T>,
139 updates: Array<{ id: string; changes: Partial<T> }>
140): ConfigTree<T> {
141 return {
142 ...tree,
143 items: tree.items.map((item) => {
144 const update = updates.find((u) => u.id === item.id)
145 return update ? { ...item, ...update.changes, updatedAt: Date.now() } : item
146 })
147 }
148}
149
150export function batchUpdateTreeFolders<T extends ConfigItemBase>(
151 tree: ConfigTree<T>,

Callers 1

settingsStore.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected