-
-
Notifications
You must be signed in to change notification settings - Fork 513
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
feat: Basic content prefetch #1186
Conversation
e6d29b9
to
d0083ce
Compare
f031881
to
6a717dc
Compare
* @param {string} path | ||
*/ | ||
export function prefetchContent(path) { | ||
const lang = document.documentElement.lang; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be problematic, it's kept sync'd to the context value normally:
Lines 56 to 59 in 67554f5
const setAndUpdateHtmlAttr = (lang) => { | |
setLang(lang); | |
document.documentElement.lang = lang; | |
}; |
While components could just pass it in & we can use the context normally, it's a bit more verbose and there's no reason to prefetch anything other than the currently set language, so abstracting it away is nicer.
Simple prefetching for content in a few cases:
Makes for a bit snappier nav on desktop.