Skip to content

fix(search): isolate Pagefind assets by version - #309

Merged
steipete merged 1 commit into
openclaw:mainfrom
0carespal:fix/pagefind-versioned-assets
Nov 14, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
0carespal:fix/pagefind-versioned-assets

Conversation

@0carespal

@0carespal 0carespal commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

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>

@0carespal
0carespal requested a review from a team as a code owner November 10, 2026 08:39
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
steipete force-pushed the fix/pagefind-versioned-assets branch from 7546064 to 607b691 Compare November 14, 2026 10:22
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}
@steipete

Copy link
Copy Markdown
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 python alias), all 15,566 rendered pages, Pagefind indexing, artifact smoke, Chromium visual checks, WebKit Mermaid checks, and all 20 community-invitation browser/theme/viewport combinations passed. The two cache-policy regression tests fail against the previous production code. Independent P0–P2 review is scoped-clean.

Before: synthetic stale cached runtime

After: versioned runtime returns results

@steipete
steipete merged commit 5063e06 into openclaw:main Nov 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs Bug]: search is unavailable — /pagefind/pagefind.js is stuck at 1.5.2 on a 1-year immutable edge cache while the index is 1.6.0

3 participants