fix(ui/books): guard null book fields in template; log null titles from PocketBase

This commit is contained in:
Admin
2026-03-04 00:49:50 +05:00
parent 89ff90629f
commit 353d7397eb
2 changed files with 9 additions and 3 deletions

View File

@@ -139,7 +139,13 @@ async function listOne<T>(collection: string, filter: string): Promise<T | null>
// ─── Books ────────────────────────────────────────────────────────────────────
export async function listBooks(): Promise<Book[]> {
return listAll<Book>('books', '', '+title');
const books = await listAll<Book>('books', '', '+title');
const nullTitles = books.filter((b) => b.title == null).length;
if (nullTitles > 0) {
log.warn('pocketbase', 'listBooks: books with null title', { count: nullTitles, total: books.length });
}
log.debug('pocketbase', 'listBooks', { total: books.length, nullTitles });
return books;
}
export async function getBook(slug: string): Promise<Book | null> {