From 07b4aa9b294ef5a14f264393248698e65ee959cd Mon Sep 17 00:00:00 2001 From: febuz Date: Thu, 23 Jul 2026 00:01:54 +0200 Subject: [PATCH] fix(studio): filter verify-list by active field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Facts and terms from every field were shown regardless of the selected field button — setField() only toggled UI chrome, never filtered #verify-list. Tag each row with its field on creation and hide rows that don't match currentField, both on insert and on field-switch, so e.g. selecting intelfield/ledgerfield no longer surfaces finfield's AAPL facts. Fixes #3 Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_019YWdCFgiCtzULqt4Sez2EC --- web/studio/fin-engine.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/web/studio/fin-engine.js b/web/studio/fin-engine.js index a625b871..0e124f00 100644 --- a/web/studio/fin-engine.js +++ b/web/studio/fin-engine.js @@ -311,6 +311,8 @@ function fmtValue(f) { function votableRow(engine, item) { const row = document.createElement("div"); row.className = "card vrow"; + row.dataset.field = item.field; + row.hidden = item.field !== currentField; const isFact = item.kind === "finfact-record"; const fieldTag = `${esc(item.field)}`; let head, body, prov; @@ -375,6 +377,19 @@ async function wireStudio(engine) { $("k-field-label").textContent = field; // The integer-only fact path is finfield-only. $("propose-section").classList.toggle("hidden", field !== "finfield"); + // Filter the verify list to this field only — facts/terms from other + // fields must never show up here (each field is its own domain knitweb). + let shown = 0; + for (const r of document.querySelectorAll("#verify-list .vrow")) { + const on = r.dataset.field === field; + r.hidden = !on; + shown += on ? 1 : 0; + } + $("verify-empty")?.remove(); + if (!shown && document.querySelectorAll("#verify-list .vrow").length) { + $("verify-list").insertAdjacentHTML("beforeend", + `

nothing to verify in ${esc(field)} yet — knit a term above.

`); + } }; for (const b of document.querySelectorAll(".field-btn")) b.addEventListener("click", () => setField(b.dataset.field));