| 2818 | } |
| 2819 | |
| 2820 | function 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. */ |
| 2834 | function ensureActivePane( |