From 523d0439f5b78a3d900051a7aec99393153bfa88 Mon Sep 17 00:00:00 2001 From: Maximilian Kaske <56969857+mxkaske@users.noreply.github.com> Date: Thu, 6 Aug 2026 22:33:19 +0200 Subject: [PATCH] perf(dashboard): cache dynamic routes 30s so prefetch pays off (#2554) Set experimental.staleTimes.dynamic to 30. Dashboard routes are dynamically rendered (auth/cookies), and Next.js defaults the dynamic router-cache staleTime to 0, which discards prefetched/visited entries on navigation. Retaining them for 30s lets sidebar prefetch and back navigation reuse the server-hydrated data instead of refetching. Claude-Session: https://claude.ai/code/session_01CMNKJWjy6Jd5tFU97AH1KR Co-authored-by: Claude --- apps/dashboard/next.config.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/dashboard/next.config.ts b/apps/dashboard/next.config.ts index cef49b6e..da03fd79 100644 --- a/apps/dashboard/next.config.ts +++ b/apps/dashboard/next.config.ts @@ -9,6 +9,11 @@ const nextConfig: NextConfig = { experimental: { // barrel-optimize only when unaliased — the rewrite would bypass the nucleo alias optimizePackageImports: useNucleoIcons ? [] : ["@openstatus/icons"], + // dashboard routes are dynamic (auth/cookies); default dynamic staleTime of 0 + // discards prefetched entries on navigation, so keep them 30s to make prefetch pay off + staleTimes: { + dynamic: 30, + }, }, turbopack: useNucleoIcons ? { resolveAlias: { "@openstatus/icons": "@openstatus/icons/nucleo" } } -- 2.51.2