create note added

This commit is contained in:
2026-02-27 14:40:10 -06:00
parent 1a497a98e8
commit 20a19006d5
3 changed files with 101 additions and 7 deletions
+4 -2
View File
@@ -801,7 +801,7 @@ export const initStore = async () => {
// 1.2 Fetch Buckets
try {
const buckets = await pb.collection(BUCKETS_COLLECTION).getFullList({ sort: 'name' });
const buckets = await pb.collection(BUCKETS_COLLECTION).getFullList({ sort: 'name', requestKey: null });
setStore("buckets", buckets.map((b: any) => ({
id: b.id,
name: b.name,
@@ -817,7 +817,8 @@ export const initStore = async () => {
const currentUserId = pb.authStore.model?.id;
const notesRecords = await pb.collection(NOTES_COLLECTION).getFullList({
filter: `isPrivate = false || user = "${currentUserId}"`,
sort: '-created'
sort: '-created',
requestKey: null
});
setStore("notes", notesRecords.map(mapRecordToNote));
} catch (notesErr) {
@@ -828,6 +829,7 @@ export const initStore = async () => {
try {
const tagRecords = await pb.collection(TAGS_COLLECTION).getFullList({
filter: `user = "${pb.authStore.model?.id}"`,
requestKey: null
});
const loadedTags: TagDefinition[] = tagRecords.map(r => ({
id: r.id,
+11 -2
View File
@@ -21,7 +21,12 @@ export const NotepadView: Component<{
const currentUserId = pb.authStore.model?.id;
// Derived states
const activeNote = createMemo(() => store.notes.find(n => n.id === props.selectedNoteId) || null);
const activeNote = createMemo(() => {
const id = props.selectedNoteId?.trim();
const note = store.notes.find(n => n.id === id) || null;
console.log('[DEBUG NotepadView] store.notes length:', store.notes.length, 'selectedNoteId:', id, 'found Note:', !!note);
return note;
});
const handleUpdateNote = async (id: string, data: Partial<Note>) => {
try {
@@ -148,7 +153,11 @@ export const NotepadView: Component<{
)}>
<Show when={activeNote()} fallback={
<div class="text-center space-y-4 opacity-40 select-none">
<p class="text-sm font-medium tracking-wide">Select a note or create a new one</p>
<Show when={props.selectedNoteId && store.notes.length === 0} fallback={
<p class="text-sm font-medium tracking-wide">Select a note or create a new one</p>
}>
<p class="text-sm font-medium tracking-wide">Loading note...</p>
</Show>
</div>
}>
{(note) => {