Luzefiru / wuwatracker

wuwatracker.com - A Collection of Wuthering Waves Tools; Pity Tracker, Game Calendar, Data Exporter, and more!
https://wuwatracker.com
62 stars 18 forks source link

refactor: use static convene pages to lessen serverless execution #57

Closed Luzefiru closed 3 weeks ago

Luzefiru commented 3 weeks ago

Problem Context

Currently, the /convene/[name] routes are being dynamically rendered and is a client component. This means it unnecessarily uses serverless function execution time when it should instead be rendered statically.

image

Solution

I turned the pages into static pages with generateStaticParams() and composed the actual data fetching to a client component inside it.

export async function generateStaticParams() {
  return Object.keys(bannerMetadata) as BannerTypeSlugEnum[];
}

Testing

Here is the performance on a forced reload (CTRL + F5). Performance it noticeably better since we can prefetch the <Link /> components on the sidebar.

demo

Closing Issues

None.

vercel[bot] commented 3 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
wuwatracker ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 8, 2024 0:52am