Skip to content

Fix version selector stuck on "Loading …" after restarts#494

Merged
thomashoneyman merged 1 commit into
masterfrom
fix-version-dropdown-loading
Jul 7, 2026
Merged

Fix version selector stuck on "Loading …" after restarts#494
thomashoneyman merged 1 commit into
masterfrom
fix-version-dropdown-loading

Conversation

@thomashoneyman

@thomashoneyman thomashoneyman commented Jul 7, 2026

Copy link
Copy Markdown
Member

The version dropdown on package pages shows Loading … indefinitely on any page that was cached before the last backend restart after the recent Nginx caching changes and #492 (e.g. https://pursuit.purescript.org/packages/purescript-yoga-fastify/0.5.2). The latest version of each package works; older/stale cached pages do not.

The version selector was initialized by a per-page inline julius script (versionSelector.julius) calling initializeVersionSelector({...}). In production, Yesod bundles a page's inline scripts into a dynamic /static/widget/<hash>.js file whose bytes are in memory and not written to disk.

When the backend restarts (any deploy), that store is emptied. nginx keeps serving the previously-cached HTML from data/cache, which references widget hashes the new process has never generated, so GET /static/widget/<hash>.js returns File not found and initializeVersionSelector never runs. Only pages re-rendered after the restart (e.g. the latest version, whose cache is cleared on publish) get a valid widget reference.

To fix it, we can initialize the version selector, search form, and load-more link from the statically embedded Pursuit.js, which is served from disk and is stable across restarts.

The version dropdown on package pages was wired up by a per-page inline
script that Yesod bundles into a dynamic /static/widget/<hash>.js file.
That file's contents live only in the running backend's in-memory
EmbeddedStatic store, so any backend restart orphaned it: nginx keeps
serving already-cached HTML referencing the old hash, the script 404s,
and the selector stays stuck on 'Loading ...'.

Drive the version selector, search form, and load-more link from the
statically embedded Pursuit.js instead. It is served from disk and is
stable across restarts. Per-page config for the selector now rides on
the <select> element as data attributes, and Pursuit.js self-initializes
on DOMContentLoaded.
@thomashoneyman thomashoneyman merged commit b22fa73 into master Jul 7, 2026
1 check passed
@thomashoneyman thomashoneyman deleted the fix-version-dropdown-loading branch July 7, 2026 20:01
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.

1 participant