MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / rewriteNoteCommentsPath

Function rewriteNoteCommentsPath

packages/app-core/src/store.ts:2820–2831  ·  view source on GitHub ↗
(
  comments: Record<string, NoteComment[]>,
  oldPath: string,
  nextPath: string
)

Source from the content-addressed store, hash-verified

2818}
2819
2820function rewriteNoteCommentsPath(
2821 comments: Record<string, NoteComment[]>,
2822 oldPath: string,
2823 nextPath: string
2824): Record<string, NoteComment[]> {
2825 if (oldPath === nextPath || !(oldPath in comments)) return comments
2826 const { [oldPath]: moving, ...rest } = comments
2827 return {
2828 ...rest,
2829 [nextPath]: moving.map((comment) => ({ ...comment, notePath: nextPath }))
2830 }
2831}
2832
2833/** Ensure `activePaneId` points at a real leaf. Falls back to first leaf. */
2834function ensureActivePane(

Callers 1

renameNoteStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected