The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(pdf): handle a failed cover bake where it happens, lower the eslint baseline
Maurice8c9cf4a80cb8
diff --git a/client/scripts/eslint-baseline.json b/client/scripts/eslint-baseline.jsonindex 9dd0c5e48..f47ce22ec 100644--- a/client/scripts/eslint-baseline.json+++ b/client/scripts/eslint-baseline.json@@ -3,8 +3,8 @@"@typescript-eslint/no-non-null-assertion": 367,"@typescript-eslint/no-misused-promises": 820,"no-console": 88,- "complexity": 217,- "@typescript-eslint/no-explicit-any": 143,+ "complexity": 216,+ "@typescript-eslint/no-explicit-any": 138,"trek/no-swallowed-catch": 126,"max-params": 31,"trek/store-without-selector": 66,@@ -12,7 +12,7 @@"react-hooks/set-state-in-effect": 189,"@typescript-eslint/no-floating-promises": 162,"react-hooks/exhaustive-deps": 113,- "@typescript-eslint/no-unused-vars": 120,+ "@typescript-eslint/no-unused-vars": 117,"react-hooks/immutability": 28,"max-lines-per-function": 127,"react-hooks/static-components": 50,@@ -35,7 +35,7 @@},"tests": {"@typescript-eslint/no-explicit-any": 489,- "@typescript-eslint/no-non-null-assertion": 1875,+ "@typescript-eslint/no-non-null-assertion": 1872,"@typescript-eslint/no-misused-promises": 22,"@typescript-eslint/no-unused-vars": 51,"@typescript-eslint/no-floating-promises": 33,diff --git a/client/src/components/PDF/TripPDF.tsx b/client/src/components/PDF/TripPDF.tsxindex 474578de3..1b0d32fa5 100644--- a/client/src/components/PDF/TripPDF.tsx+++ b/client/src/components/PDF/TripPDF.tsx@@ -292,7 +292,7 @@ export async function downloadTripPDF({ trip, days, places, assignments: allStorreturn [day.id, photos.slice(0, 3)]}))// The cover photo and its shade as one picture at print size (null: printed as before).- const bakedCover = coverImg ? await bakePdfCover(coverImg, COVER_SHADE, signal).catch(() => null) : null+ const bakedCover = coverImg ? await bakePdfCover(coverImg, COVER_SHADE, signal) : nullconst stripCopies = await shrinkPdfImages([...stripPhotos.values()].flat().map(p => p.url), signal, STRIP_PX).catch(() => new Map<string, string>())diff --git a/client/src/components/PDF/pdfImages.ts b/client/src/components/PDF/pdfImages.tsindex 40d0a4020..760979d55 100644--- a/client/src/components/PDF/pdfImages.ts+++ b/client/src/components/PDF/pdfImages.ts@@ -144,6 +144,10 @@ export async function bakePdfCover(ctx.fillRect(0, 0, COVER_W, COVER_H);const baked = canvas.toDataURL('image/jpeg', COVER_QUALITY);return baked.startsWith('data:image/jpeg') ? baked : null;+ } catch {+ // A canvas the browser will not draw or encode (out of memory on a phone, say):+ // the cover then prints the photo and its shade as separate layers, as before.+ return null;} finally {bitmap.close();}diff --git a/client/src/components/PDF/tripPdfOverview.test.ts b/client/src/components/PDF/tripPdfOverview.test.tsindex f9c803a8c..ba2c84df9 100644--- a/client/src/components/PDF/tripPdfOverview.test.ts+++ b/client/src/components/PDF/tripPdfOverview.test.ts@@ -148,12 +148,12 @@ describe('glanceHtml', () => {expect(texts(without, 'thead th')).toEqual(['pdf.day', 'common.date', 'pdf.plan', 'pdf.stay', '']);expect(texts(without, 'tbody tr:first-child td')).toEqual(['1', 'Sun, Nov 1', 'Tokyo', 'Hotel Gracery', '3']);// A day without stops leaves the cell empty rather than printing a zero.- expect(texts(without, 'tbody tr:last-child td').at(-1)).toBe('');+ expect(texts(without, 'tbody tr:last-child td').slice(-1)[0]).toBe('');expect(without.querySelector('tbody tr')?.getAttribute('style')).toBe('--day:#0a84ff');const withCost = parse(glanceHtml([row(), row({ number: 2, cost: '¥3,000' })], tr));- expect(texts(withCost, 'thead th').at(-1)).toBe('pdf.costLabel');- expect(texts(withCost, 'tbody tr:last-child td').at(-1)).toBe('¥3,000');+ expect(texts(withCost, 'thead th').slice(-1)[0]).toBe('pdf.costLabel');+ expect(texts(withCost, 'tbody tr:last-child td').slice(-1)[0]).toBe('¥3,000');expect(glanceHtml([], tr)).toBe('');});