create note added
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user