Frontend: distinguish "search unavailable" (503) from a generic search error #34
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The M5 search endpoint returns
503 Service Unavailablewhen Meilisearch is not configured (AppState.search == None), and500for an actual query failure. The frontendSearchPanelcurrently renders the samesearch.loadError("Search is unavailable") message for anyisError, so a transient backend error and a "search feature is turned off" condition look identical to the user.Ask
In
web/src/search/search-panel.tsx(and theuseSearchhook inweb/src/api/queries.tsif needed), distinguish the two:503, show a calm, explanatory message: search isn't enabled on this server (it's an optional feature — Meilisearch not configured). Don't imply a transient failure or invite retry.500/network), show the generic retry-friendly error.Notes
useSearch'squeryFncurrently throws a genericErroronerror || !data. To branch in the UI, capture the HTTP status (e.g. throw a typed error carryingresponse.status, or expose it) soSearchPanelcan rendersearch.unavailablevssearch.loadError.search.unavailablei18n key (en + sv) and a test that a 503 renders it (MSW handler returning 503).