Fix: depicts pill popover fetches real Wikidata + adds working link
Summary
- The depicts (P180) info popover used the local
KNOWN_DEPICTSmock pool for label/description and had a<button>with noonClick/ href for "Open on Wikidata" — placeholder UI for any Q-id the local vocabulary didn't already know. - Adds
fetchWikidataEntity(qid)insrc/api/commons.js(unauthenticatedwbgetentities, CORS-enabled, 5-minapiCache) and bridges it aswindow.fetchWikidataEntityvia the existing autocomplete installer. - New
DepictsPopovercomponent fetches the canonical label + description on mount (keyed by QID, cancels on unmount), falls back toKNOWN_DEPICTSfor zero-latency on cached items, shows a brief loading line otherwise, and renders the footer as<a target="_blank" rel="noopener noreferrer" href="https://www.wikidata.org/wiki/<QID>">.
Phabricator
- T425827 — Depicts pill popover shows placeholder data; needs real Wikidata fetch + 'Open on Wikidata' link
Test plan
- Open a row with depicts; click a Q-id pill from the local pool — label/description show instantly, identical to before.
-
Click a depicts pill whose QID is not in
KNOWN_DEPICTS(e.g. an obscure Q-id from a published row's SDC) — the popover briefly shows "Loading from Wikidata…" then the live label + description appear. -
Click "Open on Wikidata" — opens
https://www.wikidata.org/wiki/<QID>in a new tab. - Open the same pill again — the second open is cached (no network call within 5 min, verified via DevTools Network).
-
Try a malformed Q-id (e.g. an item with
qid: "Q999999999999") — popover stays open with the QID heading and the local fallback (or a blank desc), no crash.