diff --git a/CHANGELOG.md b/CHANGELOG.md index df7c127..7603e6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,20 @@ Please see https://github.com/purescript/pursuit/blob/master/CHANGELOG.md for the most up-to-date version of this file. +## v0.9.14 + +- Fix the version selector getting stuck on "Loading …" after a restart + (@thomashoneyman) + + The version dropdown on package pages was initialized by a per-page inline + script that Yesod bundles into a dynamic `/static/widget/.js` file, + whose contents live only in the running backend's in-memory store. Any + backend restart (such as a deploy) orphaned those widgets: nginx kept + serving already-cached HTML that referenced them, the script 404'd, and the + selector never populated. The version selector, search box, and search + "load more" link are now initialized from the statically embedded + `Pursuit.js`, which is served from disk and survives restarts. + ## v0.9.13 - Avoid decoding the latest package version just to render deprecation badges diff --git a/src/Handler/Packages.hs b/src/Handler/Packages.hs index 907417c..50bbe50 100644 --- a/src/Handler/Packages.hs +++ b/src/Handler/Packages.hs @@ -1,7 +1,6 @@ module Handler.Packages where import Import -import Text.Julius (rawJS) import Text.Blaze (ToMarkup, toMarkup) import qualified Data.Char as Char import Data.Version @@ -301,7 +300,6 @@ defaultLayout404 widget = versionSelector :: PackageName -> Version -> WidgetFor App () versionSelector pkgName version = do - versionSelectorIdent <- newIdent let route = PackageAvailableVersionsR (PathPackageName pkgName) availableVersionsUrl <- getUrlRender <*> pure route $(widgetFile "versionSelector") diff --git a/static/js/Pursuit.js b/static/js/Pursuit.js index fad0bf5..487b18c 100644 --- a/static/js/Pursuit.js +++ b/static/js/Pursuit.js @@ -1,13 +1,21 @@ (function() { -/* Expects arguments as an Object with the following properties: - * - currentVersion (String): +/* Expects the version selector // will navigate to the new page - var selector = document.getElementById(args.elementId) selector.onchange = function() { window.location.href = this.value } // Load the