fix(ui/books): guard null book fields in template; log null titles from PocketBase
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user