From b72980ad896dc3fea8f7f769610b92d54c17011a Mon Sep 17 00:00:00 2001 From: Timothy Cardoza Date: Thu, 19 Mar 2026 18:15:38 -0500 Subject: [PATCH] Task fully working except collaborative to handoff switching handling --- src/components/NotesSidebar.tsx | 4 ++++ src/store/index.ts | 1 + src/views/NotepadView.tsx | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/src/components/NotesSidebar.tsx b/src/components/NotesSidebar.tsx index 27aa17e..6709cf9 100644 --- a/src/components/NotesSidebar.tsx +++ b/src/components/NotesSidebar.tsx @@ -6,6 +6,7 @@ import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import { NOTES_COLLECTION } from "@/lib/constants"; import { FilterBar } from "./FilterBar"; +import { normalizeNoteKey } from "@/lib/tags"; export const NotesSidebar: Component<{ selectedNoteId: string | null; @@ -170,12 +171,15 @@ export const NotesSidebar: Component<{ const handleCreateNote = async () => { if (!currentUserId) return; try { + const keyBase = normalizeNoteKey("new-note"); const result = await pb.collection(NOTES_COLLECTION).create({ title: "New Note", + key: `${keyBase}-${Date.now()}`, content: "", tags: [], isPrivate: false, user: currentUserId, + tasks: [] }); props.setSelectedNoteId(result.id); } catch (e) { diff --git a/src/store/index.ts b/src/store/index.ts index 6040fd6..a0fd7fa 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -964,6 +964,7 @@ export const cleanupNoteAttachments = async (noteId: string) => { console.log(`[CLEANUP] Deleted ${filesToDelete.length} orphaned attachment(s) for note ${noteId}`); } } catch (err) { + if ((err as any)?.status === 404) return; console.error("[CLEANUP] Failed to clean up orphaned note attachments:", err); } }; diff --git a/src/views/NotepadView.tsx b/src/views/NotepadView.tsx index 8c6da05..dcf8ee9 100644 --- a/src/views/NotepadView.tsx +++ b/src/views/NotepadView.tsx @@ -14,6 +14,7 @@ import { NotesSidebar } from "@/components/NotesSidebar"; import { toast } from "solid-sonner"; import { TextBubbleMenu } from "@/components/TextBubbleMenu"; import { TableBubbleMenu } from "@/components/TableBubbleMenu"; +import { normalizeNoteKey } from "@/lib/tags"; export const NotepadView: Component<{ selectedNoteId: string | null; @@ -229,12 +230,15 @@ export const NotepadView: Component<{ if (!root || !userId) return; try { + const keyBase = normalizeNoteKey(`${root.key || root.title}-tab`); const result = await pb.collection(NOTES_COLLECTION).create({ title: "New Tab", + key: `${keyBase}-${Date.now()}`, content: "", tags: [`child-of-${root.id}`], isPrivate: root.isPrivate, // inherit privacy user: userId, + tasks: [] }); props.setSelectedNoteId(result.id); } catch (e) {