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

Function batchUpdateTreeFolders

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

Source from the content-addressed store, hash-verified

148}
149
150export function batchUpdateTreeFolders<T extends ConfigItemBase>(
151 tree: ConfigTree<T>,
152 updates: Array<{ id: string; changes: Partial<ConfigFolder> }>
153): ConfigTree<T> {
154 return {
155 ...tree,
156 folders: tree.folders.map((f) => {
157 const update = updates.find((u) => u.id === f.id)
158 return update ? { ...f, ...update.changes, updatedAt: Date.now() } : f
159 })
160 }
161}
162
163// ==================== 拖拽排序辅助 ====================
164

Callers 1

settingsStore.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected