1.18.0 performance items: reference 404 placeholder and heading font without preload, lazy form and Turnstile code (eager entry /client/eager), Turnstile space kept, background video paused for reduced motion, card hover on opacity, metadata stripped on upload, MongoDB TTL indexes for the consent log and statistics, unused-media notice, version limit for the plugin's entities

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 15:38:38 +01:00
co-authored by Claude Opus 5.5
parent 076b3ef707
commit d628839235
47 changed files with 2546 additions and 78 deletions
+33 -4
View File
@@ -37,10 +37,8 @@ const PAGES: Array<{ budget?: { desktop?: Budget; mobile?: Budget }; name: strin
{ name: 'form', path: '/pl/wycena' },
// every block × variant on one page, the contact form's Turnstile included (a necessary service, before consent)
{ budget: { desktop: { jsBytes: 230_000, thirdParty: ['https://challenges.cloudflare.com'] }, mobile: { jsBytes: 230_000, thirdParty: ['https://challenges.cloudflare.com'] } }, name: 'showcase', path: '/pl/bloki' },
// The 404 content loads after hydration (createNotFoundPage `load`, so it is not in every page's payload): it
// arrives late and moves the footer — measured CLS 0.32 and LCP 2.5 s on the phone. An owner decision in
// docs/performance.md; until then the gate holds it where it is (no worse).
{ budget: { mobile: { cls: 0.35, lcp: 3000 } }, name: '404', path: '/pl/nie-ma-takiej-strony', why: 'lazy 404 (owner decision pending)' },
// the lazy 404: its content arrives after hydration; the placeholder in not-found.tsx keeps its height (CLS 0)
{ budget: { mobile: { lcp: 2200 } }, name: '404', path: '/pl/nie-ma-takiej-strony', why: 'the 404 content comes from a server action after hydration' },
]
let browser: Browser
@@ -110,3 +108,34 @@ test.describe('queries per render', () => {
}
})
})
/**
* MongoDB TTL index of the consent log (1.18.0, shared/ttl.ts): the database deletes records older than the retention
* itself, also on a quiet site. The index exists with the retention's lifetime, and a new record carries the date it
* counts from. Skipped when not MongoDB.
*/
test('consent log: the TTL index is there and a new record carries its date', async ({ baseURL }) => {
const uri = process.env.DATABASE_URI
test.skip(!uri?.startsWith('mongodb'), 'not MongoDB')
const site = process.cwd()
const requireFromAdapter = createRequire(createRequire(path.join(site, 'package.json')).resolve('@payloadcms/db-mongodb'))
const mongoose = requireFromAdapter('mongoose') as typeof import('mongoose')
const conn = await mongoose.createConnection(uri!).asPromise()
try {
const records = conn.db!.collection('consent-records')
const ttl = (await records.indexes()).find((i) => i.name === 'iapl_ttl')
expect(ttl, 'the TTL index').toMatchObject({ expireAfterSeconds: 1095 * 86_400, key: { iaplTtlFrom: 1 } })
const id = [...crypto.getRandomValues(new Uint8Array(12))].map((b) => b.toString(16).padStart(2, '0')).join('')
const res = await fetch(`${baseURL}/api/ipal/consent`, {
body: JSON.stringify({ id, state: { analytics: false, functional: false, marketing: false, necessary: true }, version: 1 }),
headers: { 'content-type': 'application/json', origin: baseURL! },
method: 'POST',
})
expect(res.status).toBe(201)
const record = await records.findOne({ consentId: id })
expect(record?.iaplTtlFrom, 'the date the TTL counts from').toBeInstanceOf(Date)
await records.deleteOne({ consentId: id })
} finally {
await conn.close()
}
})