Repository navigation
fix(search): isolate Pagefind assets by version - #309
Merged
Merged
Conversation
Refresh compatible documentation dependencies and preserve the published anchor contract. Co-authored-by: 0carespal <satvikmishra657@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
steipete
force-pushed
the
fix/pagefind-versioned-assets
branch
from
November 14, 2026 10:22
7546064 to
607b691
Compare
| async function navigateTo(url,replace=false,animateHome=false){if(navigating)return false;navigating=true;if(!animateHome)homeGlimm.cancel();closeLanguage();closeMermaidOverlay();try{const res=await fetch(url.href,{credentials:"same-origin"});if(!res.ok||!res.headers.get("content-type")?.includes("text/html"))return false;const nextDoc=new DOMParser().parseFromString(await res.text(),"text/html");if(!nextDoc.querySelector(".main"))return false;const commit=()=>{disposeHomeHero();for(const name of ["docs-home","docs-home-layout"])document.body.classList.toggle(name,nextDoc.body.classList.contains(name));syncSidebar(nextDoc);swap(".header-left",nextDoc);swap(".main",nextDoc);initHomeHero();syncStickyHeaderOffset();syncTocDisclosure();initCodeGroups();initCodeFades();initAccordionMotion();initPageFeedback();initMermaid();document.title=nextDoc.title;history[replace?"replaceState":"pushState"]({docs:true},"",url.href);docsAnalytics.pageView();currentDocKey=location.pathname+location.search;setNavOpen(false);initTocScrollspy();scrollTarget(url.hash);syncCommunityInvite()};if(animateHome)await homeGlimm.run(commit);else commit();return true}catch{return false}finally{navigating=false}} | ||
| function unavailableSearch(){return {unavailable:true,search:async()=>({results:[]})}} | ||
| function loadPagefind(){if(pagefindReady)return pagefindReady;const src=withBase("/pagefind/pagefind.js")+(pagefindLoadAttempt?"?retry="+pagefindLoadAttempt:"");pagefindLoadAttempt+=1;pagefindReady=import(src).then(m=>m.init?.().then?.(()=>m)??m).catch(()=>{pagefindReady=null;return unavailableSearch()});return pagefindReady} | ||
| function loadPagefind(){if(pagefindReady)return pagefindReady;const src=withBase(${JSON.stringify("/" + pagefindAssetDir + "/pagefind.js")})+(pagefindLoadAttempt?"?retry="+pagefindLoadAttempt:"");pagefindLoadAttempt+=1;pagefindReady=import(src).then(m=>m.init?.().then?.(()=>m)??m).catch(()=>{pagefindReady=null;return unavailableSearch()});return pagefindReady} |
Contributor
|
Verified the regression on a synthetic docs fixture: the stale unversioned runtime produces “Search is unavailable”, while the versioned runtime returns the expected “Cron scheduler” result. The same before/after flow passed in an existing Chrome profile. Screenshots below contain only synthetic fixture content. Validation: 307 JavaScript tests, translation checks (after supplying the isolated worker’s missing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fix search failures after a Pagefind upgrade when browsers retain the old entry or worker at an immutable URL. Build and load Pagefind assets under a versioned path, verify the generated index matches the installed runtime, and shorten the cache lifetime of legacy unversioned scripts.
The new cache-policy regressions fail on the previous code. Independent P0–P2 review is scoped-clean. All 307 JavaScript tests passed, translation tests passed after providing the worker’s missing python alias, and the full 15,566-page build, search indexing, artifact smoke, Chromium/WebKit checks, and 20 community-invitation browser combinations passed on an isolated worker. Compatible development updates from #308 are included; slugify 4 is deferred because its changed transliteration behavior needs a coordinated published-anchor compatibility decision.
No authored or translated docs, production configuration, project version, or publication workflow is changed. No manual deployment is being performed.
Fixes openclaw/openclaw#196183
Co-authored-by: 0carespal satvikmishra657@gmail.com
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>