• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jcubic / 10xDevs / 19946653658

04 Dec 2025 10:56PM UTC coverage: 62.673%. Remained the same
19946653658

push

github

jcubic
10xDev Project

303 of 501 branches covered (60.48%)

Branch coverage included in aggregate %.

555 of 864 new or added lines in 49 files covered. (64.24%)

4 existing lines in 1 file now uncovered.

555 of 868 relevant lines covered (63.94%)

214.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/app/NotesLayoutWrapper.tsx
1
import { auth } from '@/lib/auth';
2
import { headers } from 'next/headers';
3
import type { Note } from '@/lib/prisma';
4
import type { NoteTreeNode } from '@/types/tree';
5
import { getNotes } from '@/app/actions/notes';
6
import { NotesProvider } from '@/components/notes/NotesContext';
7

8
interface NotesLayoutWrapperProps {
9
  children: React.ReactNode;
10
}
11

12
// Convert Prisma Note to NoteTreeNode
13
function convertNoteToTreeNode(note: Note): NoteTreeNode {
NEW
14
  return {
×
15
    id: note.noteId,
16
    name: note.name,
17
    selected: false,
18
    data: {
19
      content: note.content, // Preserve null for example notes
20
      dirty: false
21
    }
22
  };
23
}
24

25
export default async function NotesLayoutWrapper({ children }: NotesLayoutWrapperProps) {
26
  // Check if user is authenticated
NEW
27
  const session = await auth.api.getSession({
×
28
    headers: await headers()
29
  });
30

31
  // Only load notes if user is authenticated
NEW
32
  let treeNodes: NoteTreeNode[] = [];
×
NEW
33
  if (session?.user) {
×
NEW
34
    try {
×
NEW
35
      const notes = await getNotes();
×
NEW
36
      treeNodes = notes.map(convertNoteToTreeNode);
×
37
    } catch (error) {
NEW
38
      console.error('Failed to load notes:', error);
×
39
      // Continue with empty notes array
40
    }
41
  }
42

NEW
43
  return (
×
44
    <NotesProvider initialNotes={treeNodes} initialSelectedNoteId={null}>
45
      {children}
46
    </NotesProvider>
47
  );
48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc