diff --git a/src/lib/server/quote-pdf-service.ts b/src/lib/server/quote-pdf-service.ts index ee927fd..2b7b8ed 100644 --- a/src/lib/server/quote-pdf-service.ts +++ b/src/lib/server/quote-pdf-service.ts @@ -484,5 +484,9 @@ export async function isQuotePdfStale(quoteId: string): Promise { // matches chronological compare for ISO 8601 with consistent // timezone offsets, which PB always emits (UTC, no fractional // seconds). `String(a) > String(b)` is sufficient. - return itemAt > pdfAt || quoteAt > pdfAt; + // + // `itemAt` is undefined when the quote has no active items left + // (all moved/removed) — that alone doesn't make the PDF stale, so + // only the quote-level timestamp decides in that case. + return (itemAt !== undefined && itemAt > pdfAt) || quoteAt > pdfAt; }