Make the site faster to load and lighter on the server
- Every page but Home, and the whole admin, loads on first visit: the main bundle drops from 579 kB to 314 kB (173 to 98 kB gzipped); a tab on an old build reloads once when a page chunk has gone - Home asks for events and the timeline alongside its own data, and the server preloads /api/front-page and the first hero photo - Hero headline rises in as one piece (it held back the page's largest paint), sized to stay within two lines; min-h in dvh; first slide fetched at high priority - Every raster upload gets a 640px copy (at upload, and at boot for older files); logos, avatars and card pictures load it and fall back to the full file - Login password checks run off the event loop; only admin requests are logged per request; ffmpeg runs at nice 19 on Linux - Page HTML is no-cache, so a deploy can't strand a cached page on missing assets; source maps are no longer linked - Migration 042: index person_awards by award - docs/performance.md, and gzip and HTTP/2 for nginx Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
be7e92417e
commit
f72a9604d2
23 changed files with 420 additions and 139 deletions
|
|
@ -33,6 +33,7 @@ import StatsBand from './sections/home/StatsBand.tsx'
|
|||
import FeaturedBand from './sections/home/FeaturedBand.tsx'
|
||||
import FeaturedTimelineRail from './sections/home/FeaturedTimelineRail.tsx'
|
||||
import Pathfinder from './sections/home/Pathfinder.tsx'
|
||||
import { get } from '../lib/api.ts'
|
||||
import { documentTitle } from '../lib/site.ts'
|
||||
import {
|
||||
useFrontPage,
|
||||
|
|
@ -105,6 +106,15 @@ const SECTIONS: Record<
|
|||
export default function Home() {
|
||||
const { data: page, error, reload } = useFrontPage()
|
||||
|
||||
// The bands below ask for events and the timeline once the front
|
||||
// page has said which of them to show. Start both now, alongside it:
|
||||
// api.ts hands the same request to the bands when they mount, so
|
||||
// the page waits for one round trip instead of two.
|
||||
useEffect(() => {
|
||||
get('/events').catch(() => {})
|
||||
get('/history').catch(() => {})
|
||||
}, [])
|
||||
|
||||
// Back to the site name when a visitor returns here from a page.
|
||||
useEffect(() => {
|
||||
document.title = documentTitle()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue