-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Fix: langing page footer cached to display incorrect version, two solutions #469
Conversation
🦋 Changeset detectedLatest commit: c40619c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for github-socialify ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Another unexpected find is that the server-side, pre-rendered |
Thanks for looking into it! Per docs the 1 year cache should only apply to static and tagged immutable assets, very bizarre it's applied to pages too. I'm totally fine with pre-rendering but the pre-rendered version should not be cached for 1 year. I'll also do some more digging when I get time. |
This is the build output detailing the type of each of our routes (taken from latest build GitHub Actions run: https://github.com/wei/socialify/actions/runs/12435500119/job/34721445420?pr=469) for more context: Route (app) Size First Load JS
┌ ○ / 3.33 kB 114 kB
├ ○ /_not-found 155 B 106 kB
├ ƒ /[_owner]/[_name] 52.3 kB 163 kB
├ ƒ /api/font 155 B 106 kB
├ ƒ /api/graphql 155 B 106 kB
├ ƒ /api/image 155 B 106 kB
├ ƒ /api/png 155 B 106 kB
├ ƒ /api/stats 155 B 106 kB
├ ƒ /api/stats.svg 155 B 106 kB
├ ƒ /api/svg 155 B 106 kB
├ ○ /apple-icon.png 0 B 0 B
├ ○ /icon.png 0 B 0 B
├ ○ /icon.svg 0 B 0 B
└ ○ /manifest.json 0 B 0 B
+ First Load JS shared by all 106 kB
├ chunks/561-9f2716095132ab78.js 50.9 kB
├ chunks/e60cd844-3119e9860051c9f6.js 52.9 kB
└ other shared chunks (total) 1.91 kB
○ (Static) prerendered as static content
ƒ (Dynamic) server-rendered on demand |
Problem
Landing page and other static assets are cached for 1 year by NextJS 15 default setting, read more here:
https://nextjs.org/docs/app/api-reference/config/next-config-js/headers#cache-control
Current
production
landing page (static) footer displays the outdated version ofv12.7.0
,while the dynamic repo preview config page doesn't have this issue, and display the correct version of
v2.18.1
.Solution Candidates
To resolve #462
1. Request Header-based
Allow static pre-rendering of landing page, but force revalidate in request headers for all routes (can change to just landing page as well), set in
next.config.js
:https://github.com/KemingHe/contrib-socialify/blob/c40619c964394501781de6d8458c527cf1fe8654/next.config.js#L26-L54
2. Build-based
Put
export const dynamic = 'force-dynamic
inapp/layout.tsx
to force dynamic for all routes, disabling static pre-rendering (can change to just setting it for landing page as well).I'm open to other proposals and heads-ups, still learning here. ☀️ Edit: additional context.