You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My assumptions based on observations and documentation:
Next.js prefetches links in the view port by default.
Content changes in statically generated pages create files with new names based from hashes (based on the content)
Prefetched links reference the hashed content file names in the SSG files
Result:
Any content change in a page that is linked (and prefetched) at a header or footer level causes ALL pages created with SSG (that use the header/footer) to be new content essentially from the standpoint of page hashing and file names based on hashes.
This means any site wide caching strategy (based on hashing) is busted when a common link (prefetched and header/footer) has a simple content change. This seems like a fundamental issue with prefetching based on hases, not a bug or issue that can't simply be solved.
So if I am correct, what strategies are there to reduce this problem?
Initial thoughts:
Explicitly disable prefetching on any next/link in a header or footer only. Drawback lose prefetching on common landing pages etc.
Use hover/mouseover to trigger prefetching instead of in view port.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
My assumptions based on observations and documentation:
Result:
Any content change in a page that is linked (and prefetched) at a header or footer level causes ALL pages created with SSG (that use the header/footer) to be new content essentially from the standpoint of page hashing and file names based on hashes.
This means any site wide caching strategy (based on hashing) is busted when a common link (prefetched and header/footer) has a simple content change. This seems like a fundamental issue with prefetching based on hases, not a bug or issue that can't simply be solved.
So if I am correct, what strategies are there to reduce this problem?
Initial thoughts:
Beta Was this translation helpful? Give feedback.
All reactions